diff options
| author | Sean Hall <r.sean.hall@gmail.com> | 2022-07-19 15:17:10 -0500 |
|---|---|---|
| committer | Sean Hall <r.sean.hall@gmail.com> | 2022-07-20 08:53:56 -0500 |
| commit | 913b6238417dceeb8440315e4669990756d17655 (patch) | |
| tree | a9e3552ea124d2025e30436afc8629f071c01ed4 /src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs | |
| parent | 93bb820eff547f8de304f05249f572da861256fb (diff) | |
| download | wix-913b6238417dceeb8440315e4669990756d17655.tar.gz wix-913b6238417dceeb8440315e4669990756d17655.tar.bz2 wix-913b6238417dceeb8440315e4669990756d17655.zip | |
Add WixInternalUIBootstrapperApplication as a new built-in BA.
Implements 6835
Diffstat (limited to 'src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs')
| -rw-r--r-- | src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs | 474 |
1 files changed, 474 insertions, 0 deletions
diff --git a/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs b/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs new file mode 100644 index 00000000..dba78da4 --- /dev/null +++ b/src/ext/Bal/test/WixToolsetTest.Bal/InternalUIBAFixture.cs | |||
| @@ -0,0 +1,474 @@ | |||
| 1 | // Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. | ||
| 2 | |||
| 3 | namespace WixToolsetTest.Bal | ||
| 4 | { | ||
| 5 | using System; | ||
| 6 | using System.IO; | ||
| 7 | using System.Linq; | ||
| 8 | using WixBuildTools.TestSupport; | ||
| 9 | using WixToolset.Core.TestPackage; | ||
| 10 | using Xunit; | ||
| 11 | |||
| 12 | public class InternalUIBAFixture | ||
| 13 | { | ||
| 14 | [Fact] | ||
| 15 | public void CanBuildUsingWixIuiBa() | ||
| 16 | { | ||
| 17 | using (var fs = new DisposableFileSystem()) | ||
| 18 | { | ||
| 19 | var baseFolder = fs.GetFolder(); | ||
| 20 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 21 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 22 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 23 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 24 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 25 | |||
| 26 | var compileResult = WixRunner.Execute(new[] | ||
| 27 | { | ||
| 28 | "build", | ||
| 29 | Path.Combine(bundleSourceFolder, "SinglePrimaryPackage.wxs"), | ||
| 30 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 31 | "-intermediateFolder", intermediateFolder, | ||
| 32 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 33 | "-o", bundleFile, | ||
| 34 | }); | ||
| 35 | compileResult.AssertSuccess(); | ||
| 36 | |||
| 37 | Assert.True(File.Exists(bundleFile)); | ||
| 38 | |||
| 39 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 40 | extractResult.AssertSuccess(); | ||
| 41 | |||
| 42 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
| 43 | WixAssert.CompareLineByLine(new string[] | ||
| 44 | { | ||
| 45 | "<WixBalPackageInfo PackageId='test.msi' PrimaryPackageType='default' />", | ||
| 46 | }, balPackageInfos); | ||
| 47 | |||
| 48 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); | ||
| 49 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); | ||
| 50 | } | ||
| 51 | } | ||
| 52 | |||
| 53 | [Fact] | ||
| 54 | public void CanBuildUsingWixIuiBaWithImplicitPrimaryPackage() | ||
| 55 | { | ||
| 56 | using (var fs = new DisposableFileSystem()) | ||
| 57 | { | ||
| 58 | var baseFolder = fs.GetFolder(); | ||
| 59 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 60 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 61 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 62 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 63 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 64 | |||
| 65 | var compileResult = WixRunner.Execute(new[] | ||
| 66 | { | ||
| 67 | "build", | ||
| 68 | Path.Combine(bundleSourceFolder, "ImplicitPrimaryPackage.wxs"), | ||
| 69 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 70 | "-intermediateFolder", intermediateFolder, | ||
| 71 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 72 | "-o", bundleFile, | ||
| 73 | }); | ||
| 74 | compileResult.AssertSuccess(); | ||
| 75 | |||
| 76 | Assert.True(File.Exists(bundleFile)); | ||
| 77 | |||
| 78 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 79 | extractResult.AssertSuccess(); | ||
| 80 | |||
| 81 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
| 82 | WixAssert.CompareLineByLine(new string[] | ||
| 83 | { | ||
| 84 | "<WixBalPackageInfo PackageId='test.msi' PrimaryPackageType='default' />", | ||
| 85 | }, balPackageInfos); | ||
| 86 | |||
| 87 | var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); | ||
| 88 | WixAssert.CompareLineByLine(new[] | ||
| 89 | { | ||
| 90 | "<WixMbaPrereqInformation PackageId='wixnative.exe' />", | ||
| 91 | }, mbaPrereqInfos); | ||
| 92 | |||
| 93 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); | ||
| 94 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); | ||
| 95 | } | ||
| 96 | } | ||
| 97 | |||
| 98 | [Fact] | ||
| 99 | public void CanBuildUsingWixIuiBaWithWarnings() | ||
| 100 | { | ||
| 101 | using (var fs = new DisposableFileSystem()) | ||
| 102 | { | ||
| 103 | var baseFolder = fs.GetFolder(); | ||
| 104 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 105 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 106 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 107 | var baFolderPath = Path.Combine(baseFolder, "ba"); | ||
| 108 | var extractFolderPath = Path.Combine(baseFolder, "extract"); | ||
| 109 | |||
| 110 | var compileResult = WixRunner.Execute(warningsAsErrors: false, new[] | ||
| 111 | { | ||
| 112 | "build", | ||
| 113 | Path.Combine(bundleSourceFolder, "IuiBaWarnings.wxs"), | ||
| 114 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 115 | "-intermediateFolder", intermediateFolder, | ||
| 116 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 117 | "-o", bundleFile, | ||
| 118 | }); | ||
| 119 | |||
| 120 | WixAssert.CompareLineByLine(new[] | ||
| 121 | { | ||
| 122 | "WixInternalUIBootstrapperApplication does not support the value of 'force' for Cache on prereq packages. Prereq packages are only cached when they need to be installed.", | ||
| 123 | "WixInternalUIBootstrapperApplication ignores InstallCondition for the primary package so that the MSI UI is always shown.", | ||
| 124 | "WixInternalUIBootstrapperApplication ignores DisplayInternalUICondition for the primary package so that the MSI UI is always shown.", | ||
| 125 | "When using WixInternalUIBootstrapperApplication, all prereq packages should be before the primary package in the chain. The prereq packages are always installed before the primary package.", | ||
| 126 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 127 | |||
| 128 | compileResult.AssertSuccess(); | ||
| 129 | |||
| 130 | Assert.True(File.Exists(bundleFile)); | ||
| 131 | |||
| 132 | var extractResult = BundleExtractor.ExtractBAContainer(null, bundleFile, baFolderPath, extractFolderPath); | ||
| 133 | extractResult.AssertSuccess(); | ||
| 134 | |||
| 135 | var balPackageInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixBalPackageInfo"); | ||
| 136 | WixAssert.CompareLineByLine(new string[] | ||
| 137 | { | ||
| 138 | "<WixBalPackageInfo PackageId='test.msi' DisplayInternalUICondition='DISPLAYTEST' PrimaryPackageType='default' />", | ||
| 139 | }, balPackageInfos); | ||
| 140 | |||
| 141 | var mbaPrereqInfos = extractResult.GetBADataTestXmlLines("/ba:BootstrapperApplicationData/ba:WixMbaPrereqInformation"); | ||
| 142 | WixAssert.CompareLineByLine(new[] | ||
| 143 | { | ||
| 144 | "<WixMbaPrereqInformation PackageId='wixnative.exe' />", | ||
| 145 | }, mbaPrereqInfos); | ||
| 146 | |||
| 147 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.thm"))); | ||
| 148 | Assert.True(File.Exists(Path.Combine(baFolderPath, "mbapreq.wxl"))); | ||
| 149 | } | ||
| 150 | } | ||
| 151 | |||
| 152 | [Fact] | ||
| 153 | public void CannotBuildUsingWixIuiBaWithAllPrereqPackages() | ||
| 154 | { | ||
| 155 | using (var fs = new DisposableFileSystem()) | ||
| 156 | { | ||
| 157 | var baseFolder = fs.GetFolder(); | ||
| 158 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 159 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 160 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 161 | |||
| 162 | var compileResult = WixRunner.Execute(new[] | ||
| 163 | { | ||
| 164 | "build", | ||
| 165 | Path.Combine(bundleSourceFolder, "AllPrereqPackages.wxs"), | ||
| 166 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 167 | "-intermediateFolder", intermediateFolder, | ||
| 168 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 169 | "-o", bundleFile, | ||
| 170 | }); | ||
| 171 | |||
| 172 | WixAssert.CompareLineByLine(new[] | ||
| 173 | { | ||
| 174 | "When using WixInternalUIBootstrapperApplication, there must be one package with bal:PrimaryPackageType=\"default\".", | ||
| 175 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 176 | |||
| 177 | Assert.Equal(6808, compileResult.ExitCode); | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | [Fact] | ||
| 182 | public void CannotBuildUsingWixIuiBaWithImplicitNonMsiPrimaryPackage() | ||
| 183 | { | ||
| 184 | using (var fs = new DisposableFileSystem()) | ||
| 185 | { | ||
| 186 | var baseFolder = fs.GetFolder(); | ||
| 187 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 188 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 189 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 190 | |||
| 191 | var compileResult = WixRunner.Execute(new[] | ||
| 192 | { | ||
| 193 | "build", | ||
| 194 | Path.Combine(bundleSourceFolder, "ImplicitNonMsiPrimaryPackage.wxs"), | ||
| 195 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 196 | "-intermediateFolder", intermediateFolder, | ||
| 197 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 198 | "-o", bundleFile, | ||
| 199 | }); | ||
| 200 | |||
| 201 | WixAssert.CompareLineByLine(new[] | ||
| 202 | { | ||
| 203 | "When using WixInternalUIBootstrapperApplication, packages must either be non-permanent and have the bal:PrimaryPackageType attribute, or be permanent and have the bal:PrereqPackage attribute set to 'yes'.", | ||
| 204 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 205 | |||
| 206 | Assert.Equal(6811, compileResult.ExitCode); | ||
| 207 | } | ||
| 208 | } | ||
| 209 | |||
| 210 | [Fact] | ||
| 211 | public void CannotBuildUsingWixIuiBaWithImplicitPrimaryPackageEnableFeatureSelection() | ||
| 212 | { | ||
| 213 | using (var fs = new DisposableFileSystem()) | ||
| 214 | { | ||
| 215 | var baseFolder = fs.GetFolder(); | ||
| 216 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 217 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 218 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 219 | |||
| 220 | var compileResult = WixRunner.Execute(new[] | ||
| 221 | { | ||
| 222 | "build", | ||
| 223 | Path.Combine(bundleSourceFolder, "ImplicitPrimaryPackageEnableFeatureSelection.wxs"), | ||
| 224 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 225 | "-intermediateFolder", intermediateFolder, | ||
| 226 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 227 | "-o", bundleFile, | ||
| 228 | }); | ||
| 229 | |||
| 230 | WixAssert.CompareLineByLine(new[] | ||
| 231 | { | ||
| 232 | "When using WixInternalUIBootstrapperApplication, packages must either be non-permanent and have the bal:PrimaryPackageType attribute, or be permanent and have the bal:PrereqPackage attribute set to 'yes'.", | ||
| 233 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 234 | |||
| 235 | Assert.Equal(6811, compileResult.ExitCode); | ||
| 236 | } | ||
| 237 | } | ||
| 238 | |||
| 239 | [Fact] | ||
| 240 | public void CannotBuildUsingWixIuiBaWithMultipleNonPermanentNonPrimaryPackages() | ||
| 241 | { | ||
| 242 | using (var fs = new DisposableFileSystem()) | ||
| 243 | { | ||
| 244 | var baseFolder = fs.GetFolder(); | ||
| 245 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 246 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 247 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 248 | |||
| 249 | var compileResult = WixRunner.Execute(new[] | ||
| 250 | { | ||
| 251 | "build", | ||
| 252 | Path.Combine(bundleSourceFolder, "MultipleNonPermanentNonPrimaryPackages.wxs"), | ||
| 253 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 254 | "-intermediateFolder", intermediateFolder, | ||
| 255 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 256 | "-o", bundleFile, | ||
| 257 | }); | ||
| 258 | |||
| 259 | WixAssert.CompareLineByLine(new[] | ||
| 260 | { | ||
| 261 | "When using WixInternalUIBootstrapperApplication, packages must either be non-permanent and have the bal:PrimaryPackageType attribute, or be permanent and have the bal:PrereqPackage attribute set to 'yes'.", | ||
| 262 | "When using WixInternalUIBootstrapperApplication, packages must either be non-permanent and have the bal:PrimaryPackageType attribute, or be permanent and have the bal:PrereqPackage attribute set to 'yes'.", | ||
| 263 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 264 | |||
| 265 | Assert.Equal(6811, compileResult.ExitCode); | ||
| 266 | } | ||
| 267 | } | ||
| 268 | |||
| 269 | [Fact] | ||
| 270 | public void CannotBuildUsingWixIuiBaWithMultiplePrimaryPackagesOfSameType() | ||
| 271 | { | ||
| 272 | using (var fs = new DisposableFileSystem()) | ||
| 273 | { | ||
| 274 | var baseFolder = fs.GetFolder(); | ||
| 275 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 276 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 277 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 278 | |||
| 279 | var compileResult = WixRunner.Execute(new[] | ||
| 280 | { | ||
| 281 | "build", | ||
| 282 | Path.Combine(bundleSourceFolder, "MultipleDefaultPrimaryPackages.wxs"), | ||
| 283 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 284 | "-intermediateFolder", intermediateFolder, | ||
| 285 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 286 | "-o", bundleFile, | ||
| 287 | }); | ||
| 288 | |||
| 289 | WixAssert.CompareLineByLine(new[] | ||
| 290 | { | ||
| 291 | "There may only be one package in the bundle with PrimaryPackageType of 'default'.", | ||
| 292 | "The location of the package related to the previous error.", | ||
| 293 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 294 | |||
| 295 | Assert.Equal(6810, compileResult.ExitCode); | ||
| 296 | } | ||
| 297 | } | ||
| 298 | |||
| 299 | [Fact] | ||
| 300 | public void CannotBuildUsingWixIuiBaWithNoDefaultPrimaryPackage() | ||
| 301 | { | ||
| 302 | using (var fs = new DisposableFileSystem()) | ||
| 303 | { | ||
| 304 | var baseFolder = fs.GetFolder(); | ||
| 305 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 306 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 307 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 308 | |||
| 309 | var compileResult = WixRunner.Execute(new[] | ||
| 310 | { | ||
| 311 | "build", | ||
| 312 | Path.Combine(bundleSourceFolder, "NoDefaultPrimaryPackage.wxs"), | ||
| 313 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 314 | "-intermediateFolder", intermediateFolder, | ||
| 315 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 316 | "-o", bundleFile, | ||
| 317 | }); | ||
| 318 | |||
| 319 | WixAssert.CompareLineByLine(new[] | ||
| 320 | { | ||
| 321 | "When using WixInternalUIBootstrapperApplication, there must be one package with bal:PrimaryPackageType=\"default\".", | ||
| 322 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 323 | |||
| 324 | Assert.Equal(6808, compileResult.ExitCode); | ||
| 325 | } | ||
| 326 | } | ||
| 327 | |||
| 328 | [Fact] | ||
| 329 | public void CannotBuildUsingWixIuiBaWithNonMsiPrimaryPackage() | ||
| 330 | { | ||
| 331 | using (var fs = new DisposableFileSystem()) | ||
| 332 | { | ||
| 333 | var baseFolder = fs.GetFolder(); | ||
| 334 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 335 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 336 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 337 | |||
| 338 | var compileResult = WixRunner.Execute(new[] | ||
| 339 | { | ||
| 340 | "build", | ||
| 341 | Path.Combine(bundleSourceFolder, "NonMsiPrimaryPackage.wxs"), | ||
| 342 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 343 | "-intermediateFolder", intermediateFolder, | ||
| 344 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 345 | "-o", bundleFile, | ||
| 346 | }); | ||
| 347 | |||
| 348 | WixAssert.CompareLineByLine(new[] | ||
| 349 | { | ||
| 350 | "When using WixInternalUIBootstrapperApplication, each primary package must be an MsiPackage.", | ||
| 351 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 352 | |||
| 353 | Assert.Equal(6814, compileResult.ExitCode); | ||
| 354 | } | ||
| 355 | } | ||
| 356 | |||
| 357 | [Fact] | ||
| 358 | public void CannotBuildUsingWixIuiBaWithNonPermanentPrereqPackage() | ||
| 359 | { | ||
| 360 | using (var fs = new DisposableFileSystem()) | ||
| 361 | { | ||
| 362 | var baseFolder = fs.GetFolder(); | ||
| 363 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 364 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 365 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 366 | |||
| 367 | var compileResult = WixRunner.Execute(new[] | ||
| 368 | { | ||
| 369 | "build", | ||
| 370 | Path.Combine(bundleSourceFolder, "NonPermanentPrereqPackage.wxs"), | ||
| 371 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 372 | "-intermediateFolder", intermediateFolder, | ||
| 373 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 374 | "-o", bundleFile, | ||
| 375 | }); | ||
| 376 | |||
| 377 | WixAssert.CompareLineByLine(new[] | ||
| 378 | { | ||
| 379 | "When using WixInternalUIBootstrapperApplication and bal:PrereqPackage is set to 'yes', the package must be permanent.", | ||
| 380 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 381 | |||
| 382 | Assert.Equal(6812, compileResult.ExitCode); | ||
| 383 | } | ||
| 384 | } | ||
| 385 | |||
| 386 | [Fact] | ||
| 387 | public void CannotBuildUsingWixIuiBaWithPermanentPrimaryPackage() | ||
| 388 | { | ||
| 389 | using (var fs = new DisposableFileSystem()) | ||
| 390 | { | ||
| 391 | var baseFolder = fs.GetFolder(); | ||
| 392 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 393 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 394 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 395 | |||
| 396 | var compileResult = WixRunner.Execute(new[] | ||
| 397 | { | ||
| 398 | "build", | ||
| 399 | Path.Combine(bundleSourceFolder, "PermanentPrimaryPackage.wxs"), | ||
| 400 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 401 | "-intermediateFolder", intermediateFolder, | ||
| 402 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 403 | "-o", bundleFile, | ||
| 404 | }); | ||
| 405 | |||
| 406 | WixAssert.CompareLineByLine(new[] | ||
| 407 | { | ||
| 408 | "When using WixInternalUIBootstrapperApplication, packages with the bal:PrimaryPackageType attribute must not be permanent.", | ||
| 409 | "When using WixInternalUIBootstrapperApplication, there must be one package with bal:PrimaryPackageType=\"default\".", | ||
| 410 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 411 | |||
| 412 | Assert.Equal(6808, compileResult.ExitCode); | ||
| 413 | } | ||
| 414 | } | ||
| 415 | |||
| 416 | [Fact] | ||
| 417 | public void CannotBuildUsingWixIuiBaWithPrimaryPackageEnableFeatureSelection() | ||
| 418 | { | ||
| 419 | using (var fs = new DisposableFileSystem()) | ||
| 420 | { | ||
| 421 | var baseFolder = fs.GetFolder(); | ||
| 422 | var bundleFile = Path.Combine(baseFolder, "bin", "test.exe"); | ||
| 423 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 424 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 425 | |||
| 426 | var compileResult = WixRunner.Execute(new[] | ||
| 427 | { | ||
| 428 | "build", | ||
| 429 | Path.Combine(bundleSourceFolder, "PrimaryPackageEnableFeatureSelection.wxs"), | ||
| 430 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 431 | "-intermediateFolder", intermediateFolder, | ||
| 432 | "-bindpath", TestData.Get(@"TestData\WixStdBa\Data"), | ||
| 433 | "-o", bundleFile, | ||
| 434 | }); | ||
| 435 | |||
| 436 | WixAssert.CompareLineByLine(new[] | ||
| 437 | { | ||
| 438 | "When using WixInternalUIBootstrapperApplication, primary packages must not have feature selection enabled because it interferes with the user selecting feature through the MSI UI.", | ||
| 439 | "When using WixInternalUIBootstrapperApplication, there must be one package with bal:PrimaryPackageType=\"default\".", | ||
| 440 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 441 | |||
| 442 | Assert.Equal(6808, compileResult.ExitCode); | ||
| 443 | } | ||
| 444 | } | ||
| 445 | |||
| 446 | [Fact] | ||
| 447 | public void CannotBuildUsingWixIuiBaWithPrimaryPrereqPackage() | ||
| 448 | { | ||
| 449 | using (var fs = new DisposableFileSystem()) | ||
| 450 | { | ||
| 451 | var baseFolder = fs.GetFolder(); | ||
| 452 | var wixlibFile = Path.Combine(baseFolder, "bin", "test.wixlib"); | ||
| 453 | var bundleSourceFolder = TestData.Get(@"TestData\WixIuiBa"); | ||
| 454 | var intermediateFolder = Path.Combine(baseFolder, "obj"); | ||
| 455 | |||
| 456 | var compileResult = WixRunner.Execute(new[] | ||
| 457 | { | ||
| 458 | "build", | ||
| 459 | Path.Combine(bundleSourceFolder, "PrimaryPrereqPackage.wxs"), | ||
| 460 | "-ext", TestData.Get(@"WixToolset.Bal.wixext.dll"), | ||
| 461 | "-intermediateFolder", intermediateFolder, | ||
| 462 | "-o", wixlibFile, | ||
| 463 | }); | ||
| 464 | |||
| 465 | WixAssert.CompareLineByLine(new[] | ||
| 466 | { | ||
| 467 | "The MsiPackage/@PrereqPackage attribute's value, 'yes', cannot be specified with attribute PrimaryPackageType present.", | ||
| 468 | }, compileResult.Messages.Select(m => m.ToString()).ToArray()); | ||
| 469 | |||
| 470 | Assert.Equal(193, compileResult.ExitCode); | ||
| 471 | } | ||
| 472 | } | ||
| 473 | } | ||
| 474 | } | ||
