This commit is contained in:
Sean Hall 2021-05-01 20:44:43 -05:00
Родитель 0ef54303db
Коммит 70f6c04122
22 изменённых файлов: 412 добавлений и 42 удалений

Просмотреть файл

@ -73,8 +73,6 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {74DE2EED-ECAA-4FDD-9792-9D3B0C0C1321}
EndGlobalSection

Просмотреть файл

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net35;net5.0-windows</TargetFrameworks>
<AssemblyName>TestBA</AssemblyName>
<RootNamespace>WixToolset.Test.BA</RootNamespace>
<DebugType>embedded</DebugType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<EnableDynamicLoading>true</EnableDynamicLoading>
<UseWindowsForms>true</UseWindowsForms>
<RollForward>Major</RollForward>
</PropertyGroup>
<ItemGroup Condition=" '$(TargetFramework)'=='net35' ">
<Content Include="TestBA.BootstrapperCore.config" CopyToOutputDirectory="PreserveNewest" />
<Reference Include="System.Windows.Forms" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Mba.Core" Version="4.0.58" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,19 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<InstallerPlatform>x64</InstallerPlatform>
<SuppressSpecificWarnings>1154;$(SuppressSpecificWarnings)</SuppressSpecificWarnings>
<BA>hyperlinkLicense</BA>
<UpgradeCode>{6E86B95A-24F6-4C89-AF2E-470C0C734FCB}</UpgradeCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageA_x64\PackageA_x64.wixproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,10 @@
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<PackageGroup Id="BundlePackages">
<MsiPackage Id="PackageA_x64" SourceFile="$(var.PackageA_x64.TargetPath)" />
</PackageGroup>
</Fragment>
</Wix>

Просмотреть файл

@ -0,0 +1,19 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<UpgradeCode>{02258734-E25E-4A2C-AFC5-55C34F1994CB}</UpgradeCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
<Compile Include="..\BundleA\BundleA.wxs" Link="BundleB.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageA\PackageA.wixproj" />
<ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.73" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,22 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<BA>TestBA_x64</BA>
<UpgradeCode>{79F45B7A-D990-46E4-819B-078D87C3321A}</UpgradeCode>
<InstallerPlatform>x64</InstallerPlatform>
<SuppressSpecificWarnings>1154;$(SuppressSpecificWarnings)</SuppressSpecificWarnings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
<Compile Include="..\BundleA_x64\BundleA_x64.wxs" Link="BundleB_x64.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageA_x64\PackageA_x64.wixproj" />
<ProjectReference Include="..\..\TestBA\TestBAWixlib_x64\testbawixlib_x64.wixproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.73" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,20 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<BA>TestBAdnc</BA>
<UpgradeCode>{DD790BAA-FE9F-4B0D-8AF4-DE4E1D674637}</UpgradeCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
<Compile Include="..\BundleA\BundleA.wxs" Link="BundleC.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageA\PackageA.wixproj" />
<ProjectReference Include="..\..\TestBA\TestBAWixlib\testbawixlib.wixproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.73" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,22 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Bundle</OutputType>
<BA>TestBAdnc_x64</BA>
<UpgradeCode>{638D31D0-92BA-4BCD-82F0-7F549820D9AB}</UpgradeCode>
<InstallerPlatform>x64</InstallerPlatform>
<SuppressSpecificWarnings>1154;$(SuppressSpecificWarnings)</SuppressSpecificWarnings>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Bundle.wxs" Link="Bundle.wxs" />
<Compile Include="..\BundleA_x64\BundleA_x64.wxs" Link="BundleC_x64.wxs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\PackageA_x64\PackageA_x64.wixproj" />
<ProjectReference Include="..\..\TestBA\TestBAWixlib_x64\testbawixlib_x64.wixproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
<PackageReference Include="WixToolset.NetFx.wixext" Version="4.0.73" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,10 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<CabPrefix>a_x64</CabPrefix>
<UpgradeCode>{BDB9EF6A-B2DE-4929-9BE3-0CD71BDAEF6E}</UpgradeCode>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\Templates\Package.wxs" Link="Package.wxs" />
</ItemGroup>
</Project>

Просмотреть файл

@ -18,6 +18,10 @@
<!-- pulled in through the PackageGroupRef below -->
<?elseif $(var.BA) = "TestBAdnc"?>
<!-- pulled in through the PackageGroupRef below -->
<?elseif $(var.BA) = "TestBA_x64"?>
<!-- pulled in through the PackageGroupRef below -->
<?elseif $(var.BA) = "TestBAdnc_x64"?>
<!-- pulled in through the PackageGroupRef below -->
<?elseif $(var.BA) = "hyperlinkLicense"?>
<BootstrapperApplication>
<bal:WixStandardBootstrapperApplication LicenseUrl="" Theme="hyperlinkLicense" />
@ -31,6 +35,10 @@
<PackageGroupRef Id="TestBA" />
<?elseif $(var.BA) = "TestBAdnc"?>
<PackageGroupRef Id="TestBAdnc" />
<?elseif $(var.BA) = "TestBA_x64"?>
<PackageGroupRef Id="TestBA_x64" />
<?elseif $(var.BA) = "TestBAdnc_x64"?>
<PackageGroupRef Id="TestBAdnc_x64" />
<?endif?>
<PackageGroupRef Id="BundlePackages" />

Просмотреть файл

@ -35,7 +35,7 @@
</Package>
<Fragment>
<StandardDirectory Id="ProgramFilesFolder">
<StandardDirectory Id="ProgramFiles6432Folder">
<Directory Id="WixDir" Name="~Test WiX">
<Directory Id="TestDir" Name="$(var.TestGroupName)">
<Directory Id="INSTALLFOLDER" Name="$(var.PackageName)" />

Просмотреть файл

@ -0,0 +1,30 @@
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs" xmlns:bal="http://wixtoolset.org/schemas/v4/wxs/bal">
<Fragment>
<BootstrapperApplication>
<Payload SourceFile="!(bindpath.dnc5x64)\TestBA.deps.json" />
<Payload SourceFile="!(bindpath.dnc5x64)\TestBA.dll" bal:BAFactoryAssembly="yes" />
<Payload SourceFile="!(bindpath.dnc5x64)\TestBA.runtimeconfig.json" />
<Payload SourceFile="!(bindpath.dnc5x64)\mbanative.dll" />
<Payload SourceFile="!(bindpath.dnc5x64)\WixToolset.Mba.Core.dll" />
<bal:WixDotNetCoreBootstrapperApplicationHost />
</BootstrapperApplication>
<PackageGroup Id="TestBAdnc_x64">
<PackageGroupRef Id="NetFx48WebAsPrereq" /> <!-- Yes, this is wrong but we don't have .NET 5 packages yet -->
</PackageGroup>
</Fragment>
<Fragment>
<BootstrapperApplication>
<Payload Name="WixToolset.Mba.Host.config" SourceFile="!(bindpath.net2x64)\TestBA.BootstrapperCore.config" />
<Payload SourceFile="!(bindpath.net2x64)\TestBA.dll" />
<Payload SourceFile="!(bindpath.net2x64)\mbanative.dll" />
<Payload SourceFile="!(bindpath.net2x64)\WixToolset.Mba.Core.dll" />
<bal:WixManagedBootstrapperApplicationHost />
</BootstrapperApplication>
<PackageGroup Id="TestBA_x64">
<PackageGroupRef Id="NetFx48WebAsPrereq" />
</PackageGroup>
</Fragment>
</Wix>

Просмотреть файл

@ -0,0 +1,9 @@
<!-- 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. -->
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
<Fragment>
<PayloadGroup Id="TestExePayloads_x64">
<ExePackagePayload SourceFile="!(bindpath.net2x64)\TestExe.exe" />
<Payload SourceFile="!(bindpath.net2x64)\TestExe.exe.config" />
</PayloadGroup>
</Fragment>
</Wix>

Просмотреть файл

@ -0,0 +1,20 @@
<!-- 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. -->
<Project Sdk="WixToolset.Sdk">
<PropertyGroup>
<OutputType>Library</OutputType>
<BindFiles>true</BindFiles>
<Cultures>en-us</Cultures>
<InstallerPlatform>x64</InstallerPlatform>
</PropertyGroup>
<ItemGroup>
<BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net35\win-x64" BindName="net2x64" />
<BindInputPaths Include="$(BaseOutputPath)$(Configuration)\net5.0-windows\win-x64" BindName="dnc5x64" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\TestBA\TestBA_x64.csproj" />
<ProjectReference Include="..\..\..\TestExe\TestExe_x64.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="WixToolset.Bal.wixext" Version="4.0.101" />
</ItemGroup>
</Project>

Просмотреть файл

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net35</TargetFrameworks>
<AssemblyName>TestExe</AssemblyName>
<RootNamespace>TestExe</RootNamespace>
<OutputType>Exe</OutputType>
<DebugType>embedded</DebugType>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<Reference Include="System.Management" />
</ItemGroup>
</Project>

Просмотреть файл

@ -88,9 +88,10 @@ namespace WixTestTools
public string Version { get; set; }
public static bool TryGetPerMachineBundleRegistrationById(string bundleId, out BundleRegistration registration)
public static bool TryGetPerMachineBundleRegistrationById(string bundleId, bool x64, out BundleRegistration registration)
{
var registrationKeyPath = $"{BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE}\\{bundleId}";
var baseKeyPath = x64 ? BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY : BURN_REGISTRATION_REGISTRY_UNINSTALL_KEY_WOW6432NODE;
var registrationKeyPath = $"{baseKeyPath}\\{bundleId}";
using var registrationKey = Registry.LocalMachine.OpenSubKey(registrationKeyPath);
var success = registrationKey != null;
registration = success ? GetBundleRegistration(registrationKey) : null;

Просмотреть файл

@ -73,10 +73,11 @@ namespace WixTestTools
public bool TryGetRegistration(out BundleRegistration registration)
{
var bundleSymbol = this.GetBundleSymbol();
var x64 = bundleSymbol.Platform != Platform.X86;
var bundleId = bundleSymbol.BundleId;
if (bundleSymbol.PerMachine)
{
return BundleRegistration.TryGetPerMachineBundleRegistrationById(bundleId, out registration);
return BundleRegistration.TryGetPerMachineBundleRegistrationById(bundleId, x64, out registration);
}
else
{
@ -132,9 +133,9 @@ namespace WixTestTools
Assert.True(Directory.Exists(cachePath));
}
public void VerifyExeTestRegistryRootDeleted(string name)
public void VerifyExeTestRegistryRootDeleted(string name, bool x64 = false)
{
using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(name);
using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(x64, name);
if (testRegistryRoot != null)
{
var actualValue = testRegistryRoot.GetValue("Version") as string;
@ -142,9 +143,9 @@ namespace WixTestTools
}
}
public void VerifyExeTestRegistryValue(string name, string expectedValue)
public void VerifyExeTestRegistryValue(string name, string expectedValue, bool x64 = false)
{
using (var root = this.TestContext.GetTestRegistryRoot(name))
using (var root = this.TestContext.GetTestRegistryRoot(x64, name))
{
Assert.NotNull(root);
var actualValue = root.GetValue("Version") as string;

Просмотреть файл

@ -4,6 +4,10 @@ namespace WixTestTools
{
using System;
using System.IO;
using System.Linq;
using WixToolset.Data;
using WixToolset.Data.Symbols;
using WixToolset.Data.WindowsInstaller;
using static WixTestTools.MSIExec;
public partial class PackageInstaller : IDisposable
@ -13,6 +17,16 @@ namespace WixTestTools
this.Package = Path.Combine(testContext.TestDataFolder, $"{filename}.msi");
this.PackagePdb = Path.Combine(testContext.TestDataFolder, $"{filename}.wixpdb");
this.TestContext = testContext;
using var wixOutput = WixOutput.Read(this.PackagePdb);
var intermediate = Intermediate.Load(wixOutput);
var section = intermediate.Sections.Single();
var platformSummary = section.Symbols.OfType<SummaryInformationSymbol>().Single(s => s.PropertyId == SummaryInformationType.PlatformAndLanguage);
var platformString = platformSummary.Value.Split(new char[] { ';' }, 2)[0];
this.IsX64 = platformString != "Intel";
this.WiData = WindowsInstallerData.Load(wixOutput);
}
public string Package { get; }

Просмотреть файл

@ -5,7 +5,6 @@ namespace WixTestTools
using System;
using System.IO;
using System.Linq;
using WixToolset.Data;
using WixToolset.Data.WindowsInstaller;
using WixToolset.Data.WindowsInstaller.Rows;
using Xunit;
@ -14,28 +13,18 @@ namespace WixTestTools
{
public string PackagePdb { get; }
private WindowsInstallerData WiData { get; set; }
private bool IsX64 { get; }
private WindowsInstallerData WiData { get; }
public string GetInstalledFilePath(string filename)
{
return this.TestContext.GetTestInstallFolder(Path.Combine(this.GetInstallFolderName(), filename));
}
private WindowsInstallerData GetWindowsInstallerData()
{
if (this.WiData == null)
{
using var wixOutput = WixOutput.Read(this.PackagePdb);
this.WiData = WindowsInstallerData.Load(wixOutput);
}
return this.WiData;
return this.TestContext.GetTestInstallFolder(this.IsX64, Path.Combine(this.GetInstallFolderName(), filename));
}
public string GetInstallFolderName()
{
var wiData = this.GetWindowsInstallerData();
var row = wiData.Tables["Directory"].Rows.Single(r => r.FieldAsString(0) == "INSTALLFOLDER");
var row = this.WiData.Tables["Directory"].Rows.Single(r => r.FieldAsString(0) == "INSTALLFOLDER");
var value = row.FieldAsString(2);
var longNameIndex = value.IndexOf('|') + 1;
if (longNameIndex > 0)
@ -47,8 +36,7 @@ namespace WixTestTools
public string GetProperty(string name)
{
var wiData = this.GetWindowsInstallerData();
var row = wiData.Tables["Property"].Rows.Cast<PropertyRow>().Single(r => r.Property == name);
var row = this.WiData.Tables["Property"].Rows.Cast<PropertyRow>().Single(r => r.Property == name);
return row.Value;
}
@ -67,7 +55,7 @@ namespace WixTestTools
public void DeleteTestRegistryValue(string name)
{
using (var root = this.TestContext.GetTestRegistryRoot())
using (var root = this.TestContext.GetTestRegistryRoot(this.IsX64))
{
Assert.NotNull(root);
root.DeleteValue(name);
@ -76,13 +64,13 @@ namespace WixTestTools
public void VerifyTestRegistryRootDeleted()
{
using var testRegistryRoot = this.TestContext.GetTestRegistryRoot();
using var testRegistryRoot = this.TestContext.GetTestRegistryRoot(this.IsX64);
Assert.Null(testRegistryRoot);
}
public void VerifyTestRegistryValue(string name, string expectedValue)
{
using (var root = this.TestContext.GetTestRegistryRoot())
using (var root = this.TestContext.GetTestRegistryRoot(this.IsX64))
{
Assert.NotNull(root);
var actualValue = root.GetValue(name) as string;

Просмотреть файл

@ -42,9 +42,10 @@ namespace WixTestTools
/// <remarks>
/// The package or bundle must install into [ProgramFilesFolder]\~Test WiX\[TestGroupName]\([Additional]).
/// </remarks>
public string GetTestInstallFolder(string additionalPath = null)
public string GetTestInstallFolder(bool x64, string additionalPath = null)
{
return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86), "~Test WiX", this.TestGroupName, additionalPath ?? String.Empty);
var baseDirectory = x64 ? Environment.SpecialFolder.ProgramFiles : Environment.SpecialFolder.ProgramFilesX86;
return Path.Combine(Environment.GetFolderPath(baseDirectory), "~Test WiX", this.TestGroupName, additionalPath ?? String.Empty);
}
/// <summary>
@ -55,9 +56,10 @@ namespace WixTestTools
/// <remarks>
/// The package must write into HKLM\Software\WiX\Tests\[TestGroupName]\([Additional]).
/// </remarks>
public RegistryKey GetTestRegistryRoot(string additionalPath = null)
public RegistryKey GetTestRegistryRoot(bool x64, string additionalPath = null)
{
var key = String.Format(@"Software\WOW6432Node\WiX\Tests\{0}\{1}", this.TestGroupName, additionalPath ?? String.Empty);
var baseKey = x64 ? "Software" : @"Software\WOW6432Node";
var key = String.Format(@"{0}\WiX\Tests\{1}\{2}", baseKey, this.TestGroupName, additionalPath ?? String.Empty);
return Registry.LocalMachine.OpenSubKey(key, true);
}

Просмотреть файл

@ -12,7 +12,7 @@ namespace WixToolsetTest.BurnE2E
public BasicFunctionalityTests(ITestOutputHelper testOutputHelper) : base(testOutputHelper) { }
[Fact]
public void CanInstallAndUninstallSimpleBundle()
public void CanInstallAndUninstallSimpleBundle_x86_wixstdba()
{
var packageA = this.CreatePackageInstaller("PackageA");
@ -37,5 +37,140 @@ namespace WixToolsetTest.BurnE2E
bundleA.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
[Fact]
public void CanInstallAndUninstallSimpleBundle_x86_testba()
{
var packageA = this.CreatePackageInstaller("PackageA");
var bundleB = this.CreateBundleInstaller("BundleB");
var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
bundleB.Install();
var cachedBundlePath = bundleB.VerifyRegisteredAndInPackageCache();
// Source file should be installed
Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
bundleB.Uninstall(cachedBundlePath);
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
bundleB.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
[Fact]
public void CanInstallAndUninstallSimpleBundle_x86_dnctestba()
{
var packageA = this.CreatePackageInstaller("PackageA");
var bundleC = this.CreateBundleInstaller("BundleC");
var packageASourceCodeInstalled = packageA.GetInstalledFilePath("Package.wxs");
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A payload should not be there on test start: {packageASourceCodeInstalled}");
bundleC.Install();
var cachedBundlePath = bundleC.VerifyRegisteredAndInPackageCache();
// Source file should be installed
Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
bundleC.Uninstall(cachedBundlePath);
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
bundleC.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
[Fact]
public void CanInstallAndUninstallSimpleBundle_x64_wixstdba()
{
var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");
var bundleA_x64 = this.CreateBundleInstaller("BundleA_x64");
var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}");
bundleA_x64.Install();
var cachedBundlePath = bundleA_x64.VerifyRegisteredAndInPackageCache();
// Source file should be installed
Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));
bundleA_x64.Uninstall(cachedBundlePath);
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
bundleA_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
[Fact]
public void CanInstallAndUninstallSimpleBundle_x64_testba()
{
var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");
var bundleB_x64 = this.CreateBundleInstaller("BundleB_x64");
var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}");
bundleB_x64.Install();
var cachedBundlePath = bundleB_x64.VerifyRegisteredAndInPackageCache();
// Source file should be installed
Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));
bundleB_x64.Uninstall(cachedBundlePath);
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
bundleB_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
[Fact]
public void CanInstallAndUninstallSimpleBundle_x64_dnctestba()
{
var packageA_x64 = this.CreatePackageInstaller("PackageA_x64");
var bundleC_x64 = this.CreateBundleInstaller("BundleC_x64");
var packageASourceCodeInstalled = packageA_x64.GetInstalledFilePath("Package.wxs");
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), $"Package A x64 payload should not be there on test start: {packageASourceCodeInstalled}");
bundleC_x64.Install();
var cachedBundlePath = bundleC_x64.VerifyRegisteredAndInPackageCache();
// Source file should be installed
Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A x64 payload installed at: ", packageASourceCodeInstalled));
bundleC_x64.Uninstall(cachedBundlePath);
// Source file should *not* be installed
Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A x64 payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
bundleC_x64.VerifyUnregisteredAndRemovedFromPackageCache(cachedBundlePath);
}
}
}

Просмотреть файл

@ -9,14 +9,15 @@ namespace WixToolsetTest.BurnE2E
public class TestBAController : IDisposable
{
private const string BaseRegKeyPath = @"Software\WOW6432Node\WiX\Tests";
public TestBAController(WixTestContext testContext)
public TestBAController(WixTestContext testContext, bool x64 = false)
{
this.TestGroupName = testContext.TestGroupName;
this.TestBaseRegKeyPath = String.Format(@"{0}\TestBAControl\{1}", BaseRegKeyPath, this.TestGroupName);
this.BaseRegKeyPath = x64 ? @"Software\WiX\Tests" : @"Software\WOW6432Node\WiX\Tests";
this.TestBaseRegKeyPath = String.Format(@"{0}\TestBAControl\{1}", this.BaseRegKeyPath, this.TestGroupName);
}
private string BaseRegKeyPath { get; }
private string TestBaseRegKeyPath { get; }
public string TestGroupName { get; }
@ -179,8 +180,8 @@ namespace WixToolsetTest.BurnE2E
public void Dispose()
{
Registry.LocalMachine.DeleteSubKeyTree($@"{BaseRegKeyPath}\{this.TestGroupName}", false);
Registry.LocalMachine.DeleteSubKeyTree($@"{BaseRegKeyPath}\TestBAControl", false);
Registry.LocalMachine.DeleteSubKeyTree($@"{this.BaseRegKeyPath}\{this.TestGroupName}", false);
Registry.LocalMachine.DeleteSubKeyTree($@"{this.BaseRegKeyPath}\TestBAControl", false);
}
}
}