aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSean Hall <r.sean.hall@gmail.com>2023-01-15 20:59:56 -0600
committerSean Hall <r.sean.hall@gmail.com>2023-01-15 22:03:31 -0600
commitecbaffc08239e061a7dbaa92ff3c72acd53a0bae (patch)
treef6bf6660fc35b82085388ed489f4160c71ae68e1
parent32024b526d129534b017d4e932f08e6a6f015102 (diff)
downloadwix-ecbaffc08239e061a7dbaa92ff3c72acd53a0bae.tar.gz
wix-ecbaffc08239e061a7dbaa92ff3c72acd53a0bae.tar.bz2
wix-ecbaffc08239e061a7dbaa92ff3c72acd53a0bae.zip
Write an error when the .NET Core BA is missing the BAFactoryAssembly.
7166
-rw-r--r--src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs29
-rw-r--r--src/ext/Bal/test/WixToolsetTest.Bal/TestData/Dncba/Bundle.wxs13
-rw-r--r--src/ext/Bal/wixext/BalBurnBackendExtension.cs6
-rw-r--r--src/ext/Bal/wixext/BalErrors.cs6
4 files changed, 52 insertions, 2 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs
index 32ff42b5..57dbda9c 100644
--- a/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs
+++ b/src/ext/Bal/test/WixToolsetTest.Bal/BalExtensionFixture.cs
@@ -185,6 +185,35 @@ namespace WixToolsetTest.Bal
185 } 185 }
186 186
187 [Fact] 187 [Fact]
188 public void CannotBuildUsingDncbaMissingBAFactoryPayload()
189 {
190 using (var fs = new DisposableFileSystem())
191 {
192 var baseFolder = fs.GetFolder();
193 var bundleFile = Path.Combine(baseFolder, "bin", "test.exe");
194 var bundleSourceFolder = TestData.Get(@"TestData\Dncba");
195 var intermediateFolder = Path.Combine(baseFolder, "obj");
196
197 var compileResult = WixRunner.Execute(new[]
198 {
199 "build",
200 Path.Combine(bundleSourceFolder, "Bundle.wxs"),
201 "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"),
202 "-intermediateFolder", intermediateFolder,
203 "-o", bundleFile,
204 });
205 WixAssert.CompareLineByLine(new[]
206 {
207 "The BA's entry point DLL must have bal:BAFactoryAssembly=\"yes\" when using the DotNetCoreBootstrapperApplicationHost.",
208 }, compileResult.Messages.Select(x => x.ToString()).ToArray());
209 Assert.Equal(6818, compileResult.ExitCode);
210
211 Assert.False(File.Exists(bundleFile));
212 Assert.False(File.Exists(Path.Combine(intermediateFolder, "test.exe")));
213 }
214 }
215
216 [Fact]
188 public void CannotBuildUsingOverridableWrongCase() 217 public void CannotBuildUsingOverridableWrongCase()
189 { 218 {
190 using (var fs = new DisposableFileSystem()) 219 using (var fs = new DisposableFileSystem())
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Dncba/Bundle.wxs b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Dncba/Bundle.wxs
new file mode 100644
index 00000000..5b25da8c
--- /dev/null
+++ b/src/ext/Bal/test/WixToolsetTest.Bal/TestData/Dncba/Bundle.wxs
@@ -0,0 +1,13 @@
1<?xml version="1.0" encoding="utf-8"?>
2<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs"
3 xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
4 <Bundle Name="WixStdBa" Version="1.0.0.0" Manufacturer="Example Corporation" UpgradeCode="75D5D534-E177-4689-AAE9-CAC1C39002C2">
5 <BootstrapperApplication>
6 <bal:WixDotNetCoreBootstrapperApplicationHost SelfContainedDeployment="yes" />
7 <Payload SourceFile="runtimes\win-x86\native\wixnative.exe" />
8 </BootstrapperApplication>
9 <Chain>
10 <ExePackage Permanent="yes" DetectCondition="none" SourceFile="runtimes\win-x86\native\wixnative.exe" />
11 </Chain>
12 </Bundle>
13</Wix>
diff --git a/src/ext/Bal/wixext/BalBurnBackendExtension.cs b/src/ext/Bal/wixext/BalBurnBackendExtension.cs
index a27ff739..be294131 100644
--- a/src/ext/Bal/wixext/BalBurnBackendExtension.cs
+++ b/src/ext/Bal/wixext/BalBurnBackendExtension.cs
@@ -121,7 +121,7 @@ namespace WixToolset.Bal
121 121
122 if (isDNC) 122 if (isDNC)
123 { 123 {
124 this.FinalizeBAFactorySymbol(section); 124 this.FinalizeBAFactorySymbol(section, baSymbol);
125 } 125 }
126 126
127 if (isIuiBA || isStdBA || isMBA || isDNC) 127 if (isIuiBA || isStdBA || isMBA || isDNC)
@@ -135,11 +135,12 @@ namespace WixToolset.Bal
135 } 135 }
136 } 136 }
137 137
138 private void FinalizeBAFactorySymbol(IntermediateSection section) 138 private void FinalizeBAFactorySymbol(IntermediateSection section, WixBootstrapperApplicationDllSymbol baSymbol)
139 { 139 {
140 var factorySymbol = section.Symbols.OfType<WixBalBAFactoryAssemblySymbol>().SingleOrDefault(); 140 var factorySymbol = section.Symbols.OfType<WixBalBAFactoryAssemblySymbol>().SingleOrDefault();
141 if (null == factorySymbol) 141 if (null == factorySymbol)
142 { 142 {
143 this.Messaging.Write(BalErrors.MissingDNCBAFactoryAssembly(baSymbol.SourceLineNumbers));
143 return; 144 return;
144 } 145 }
145 146
@@ -148,6 +149,7 @@ namespace WixToolset.Bal
148 .SingleOrDefault(); 149 .SingleOrDefault();
149 if (null == factoryPayloadSymbol) 150 if (null == factoryPayloadSymbol)
150 { 151 {
152 this.Messaging.Write(BalErrors.MissingDNCBAFactoryAssembly(factorySymbol.SourceLineNumbers));
151 return; 153 return;
152 } 154 }
153 155
diff --git a/src/ext/Bal/wixext/BalErrors.cs b/src/ext/Bal/wixext/BalErrors.cs
index cde37143..2548b279 100644
--- a/src/ext/Bal/wixext/BalErrors.cs
+++ b/src/ext/Bal/wixext/BalErrors.cs
@@ -43,6 +43,11 @@ namespace WixToolset.Bal
43 return Message(sourceLineNumbers, Ids.IuibaPrimaryPackageEnableFeatureSelection, "When using WixInternalUIBootstrapperApplication, primary packages must not have feature selection enabled because it interferes with the user selecting feature through the MSI UI."); 43 return Message(sourceLineNumbers, Ids.IuibaPrimaryPackageEnableFeatureSelection, "When using WixInternalUIBootstrapperApplication, primary packages must not have feature selection enabled because it interferes with the user selecting feature through the MSI UI.");
44 } 44 }
45 45
46 public static Message MissingDNCBAFactoryAssembly(SourceLineNumber sourceLineNumbers)
47 {
48 return Message(sourceLineNumbers, Ids.MissingDNCBAFactoryAssembly, "The BA's entry point DLL must have bal:BAFactoryAssembly=\"yes\" when using the DotNetCoreBootstrapperApplicationHost.");
49 }
50
46 public static Message MissingDNCPrereq() 51 public static Message MissingDNCPrereq()
47 { 52 {
48 return Message(null, Ids.MissingDNCPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\"."); 53 return Message(null, Ids.MissingDNCPrereq, "There must be at least one package with bal:PrereqPackage=\"yes\" when using the DotNetCoreBootstrapperApplicationHost with SelfContainedDeployment set to \"no\".");
@@ -116,6 +121,7 @@ namespace WixToolset.Bal
116 IuibaPrimaryPackageEnableFeatureSelection = 6815, 121 IuibaPrimaryPackageEnableFeatureSelection = 6815,
117 OverridableVariableCollision = 6816, 122 OverridableVariableCollision = 6816,
118 OverridableVariableCollision2 = 6817, 123 OverridableVariableCollision2 = 6817,
124 MissingDNCBAFactoryAssembly = 6818,
119 } 125 }
120 } 126 }
121} 127}