public void Burn_InstallUninstall() { string v2Version = "2.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageC", packageC); // Add the bindpath for the cab for C to enable to add it as a payload for BundleA bindPaths.Add("packageCcab", Path.Combine(Path.GetDirectoryName(packageC), "cab1.cab")); // Build the embedded bundle. string bundleBv2 = new BundleBuilder(this, "BundleBv2") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", v2Version } } }.Build().Output; // Build the parent bundle. bindPaths.Add("bundleBv2", bundleBv2); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the parent bundle that will install the embedded bundle. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageC)); // Attempt to uninstall bundleA, which will uninstall bundleB since it is a patch related bundle. installerA.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(MsiVerifier.IsPackageInstalled(packageC)); this.Complete(); }
public void Burn_RedirectPackageCache() { const string PolicyName = "PackageCache"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; RegistryKey policy = Registry.LocalMachine.CreateSubKey(@"Software\Policies\WiX\Burn"); string currentPackageCache = null; try { currentPackageCache = policy.GetValue(PolicyName) as string; // Install the first bundle using the default package cache. policy.DeleteValue(PolicyName); BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); // Install the second bundle which has a shared package using the redirected package cache. string path = Path.Combine(Path.GetTempPath(), "Package Cache"); policy.SetValue(PolicyName, path); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // The first bundle should leave package A behind. installerA.Uninstall(); // Now make sure that the second bundle removes packages from either cache directory. installerB.Uninstall(); this.Complete(); } finally { if (!string.IsNullOrEmpty(currentPackageCache)) { policy.SetValue(PolicyName, currentPackageCache); } else { policy.DeleteValue(PolicyName); } policy.Dispose(); } }
public void Burn_InstallUpdatedBundle() { // Build the packages. string packageA1 = this.GetPackageA().Output; string packageA2 = this.GetPackageAv2().Output; // Build the bundles. string bundleA1 = this.GetBundleA().Output; string bundleA2 = this.GetBundleAv2().Output; // Install the v1 bundle. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(arguments: String.Concat("\"", "-updatebundle:", bundleA2, "\"")); BundleInstaller installerA2 = new BundleInstaller(this, bundleA2); // Test that only the newest packages is installed. Assert.False(MsiVerifier.IsPackageInstalled(packageA1)); Assert.True(MsiVerifier.IsPackageInstalled(packageA2)); // Attempt to uninstall bundleA2. installerA2.Uninstall(); // Test all packages are uninstalled. Assert.False(MsiVerifier.IsPackageInstalled(packageA1)); Assert.False(MsiVerifier.IsPackageInstalled(packageA2)); Assert.Null(this.GetTestRegistryRoot()); this.Complete(); }
public void Burn_PermanentInstallForceUninstall() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install Bundle A. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // Force Uninstall Bundle A. this.SetPackageRequestedState("PackageA", Microsoft.Tools.WindowsInstallerXml.Bootstrapper.RequestState.ForceAbsent); this.SetPackageRequestedState("PackageB", Microsoft.Tools.WindowsInstallerXml.Bootstrapper.RequestState.ForceAbsent); installerA.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(MsiVerifier.IsPackageInstalled(packageB)); this.Complete(); }
public void Burn_PermanentInstallUninstall() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install Bundle A. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // Uninstall bundleA. installerA.Uninstall(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(MsiVerifier.IsPackageInstalled(packageB)); this.Complete(); }
public void Burn_ComponentSearchResults() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // PackageB will be installed if all ComponentSearches worked. Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // Uninstall the main bundle and add-on. installerA.Uninstall(); this.Complete(); }
public void Burn_InstallUninstallBundleWithEmbeddedBundle() { // Build the packages. string packageA1 = new PackageBuilder(this, "A").Build().Output; string packageB1 = new PackageBuilder(this, "B").Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageB", packageB1); // Build the embedded bundle. string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Build the parent bundle bindPaths.Add("bundleB", bundleB); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); // Test package is installed. Assert.True(MsiVerifier.IsPackageInstalled(packageA1)); Assert.True(MsiVerifier.IsPackageInstalled(packageB1)); // Attempt to uninstall bundleA. installerA.Uninstall(); // Test package is uninstalled. Assert.False(MsiVerifier.IsPackageInstalled(packageA1)); Assert.False(MsiVerifier.IsPackageInstalled(packageB1)); this.Complete(); }
public void Burn_ParentInstallAddonUninstall() { // Build. string packageA = this.GetPackageA().Output; string bundleA = this.GetBundleA().Output; string packageD = this.GetPackageD().Output; string bundleD = this.GetBundleD().Output; // Install the base bundle, and ensure it is installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); // Install the addon bundle, and ensure it is installed. BundleInstaller installerD = new BundleInstaller(this, bundleD).Install(arguments: "-parent Foo"); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD)); // Uninstall the base bundle and ensure it is removed but addon is still present. installerA.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD)); // Uninstall addon bundle with the parent and ensure everything is removed. installerD.Uninstall(arguments: "-parent Foo"); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); this.CleanTestArtifacts = true; }
public void Burn_InstallUninstallAddonPatchRelatedBundle() { // Build the packages. string packageA = new PackageBuilder(this, "A").Build().Output; string packageC1 = new PackageBuilder(this, "C").Build().Output; string packageC2 = new PackageBuilder(this, "C") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", "1.0.1.0" } } }.Build().Output; string packageD = new PackageBuilder(this, "D").Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageC", packageC1); bindPaths.Add("packageD", packageD); // Build the base and addon bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Update path to C2 and build the addon patch bundle. bindPaths["packageC"] = packageC2; string bundleE = new BundleBuilder(this, "BundleE") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", "1.0.1.0" } } }.Build().Output; // Install the base and addon bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); // Test that packages A and C1 but not D are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Install the patch to the addon. BundleInstaller installerE = new BundleInstaller(this, bundleE).Install(); // Test that packages A and C2 but not D are installed, and that C1 was upgraded. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Attempt to uninstall bundleA. installerA.Uninstall(); // Test that uninstalling bundle A detected and removed bundle C, which removed bundle E (can't easily reference log). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Remove")); // Test that all packages are uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); this.CleanTestArtifacts = true; }
public void Burn_InstallLockUninstallInstallUninstall() { // Build. string packageA = this.GetPackageA().Output; string bundleA = this.GetBundleA().Output; BundleRegistration registration = null; // Install. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(this.TryGetBundleRegistration("5802E2D0-AC39-4486-86FF-D4B7AD012EB5", out registration)); Assert.Equal("~Burn_InstallLockUninstallInstallUninstall - Bundle A", registration.DisplayName); Assert.Equal(1, registration.Installed); Assert.Equal("1.0.0.0", registration.Version); // Uninstall while the file is locked. BundleInstaller uninstallerA = new BundleInstaller(this, registration.UninstallCommand); using (FileStream lockBundle = File.Open(registration.UninstallCommand, FileMode.Open, FileAccess.Read, FileShare.Read)) { uninstallerA.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(this.TryGetBundleRegistration("5802E2D0-AC39-4486-86FF-D4B7AD012EB5", out registration)); Assert.Null(registration); } // Install again. installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(this.TryGetBundleRegistration("5802E2D0-AC39-4486-86FF-D4B7AD012EB5", out registration)); Assert.Equal("~Burn_InstallLockUninstallInstallUninstall - Bundle A", registration.DisplayName); Assert.Equal(1, registration.Installed); Assert.Equal("1.0.0.0", registration.Version); // Uninstall again. uninstallerA.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(this.TryGetBundleRegistration("5802E2D0-AC39-4486-86FF-D4B7AD012EB5", out registration)); Assert.Null(registration); this.Completed(); }
public void Burn_PatchInstallUninstall() { string originalVersion = "1.0.0.0"; string patchedVersion = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleAPatch = new BundleBuilder(this, "PatchBundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the unpatched bundle. BundleInstaller installA = new BundleInstaller(this, bundleA).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(originalVersion, actualVersion); } // Install the patch bundle. BundleInstaller installAPatch = new BundleInstaller(this, bundleAPatch).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(patchedVersion, actualVersion); } // Uninstall the patch bundle. installAPatch.Uninstall(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(originalVersion, actualVersion); } installA.Uninstall(); Assert.IsNull(this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.CleanTestArtifacts = true; }
public void Burn_AutomaticSlipstreamInstallUninstall() { const string originalVersion = "1.0.0.0"; const string patchedVersion = "1.0.1.0"; // Build the packages. string packageA = this.GetPackageA().Output; string packageAUpdate = this.GetPackageAv101().Output; string packageB = this.GetPackageB().Output; string packageBUpdate = new PackageBuilder(this, "B") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion} }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { packageA, packageB }, UpgradePaths = new string[] { packageAUpdate, packageBUpdate } }.Build().Output; string patchB = new PatchBuilder(this, "PatchB") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { packageA, packageB }, UpgradePaths = new string[] { packageAUpdate, packageBUpdate } }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); bindPaths.Add("patchA", patchA); bindPaths.Add("patchB", patchB); string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; BundleInstaller install = new BundleInstaller(this, bundleC).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { // Product A should've slipstreamed both patches. string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); actualVersion = root.GetValue("A2") as string; Assert.Equal(patchedVersion, actualVersion); // Product B should've only slipstreamed patch B. actualVersion = root.GetValue("B") as string; Assert.Equal(originalVersion, actualVersion); actualVersion = root.GetValue("B2") as string; Assert.Equal(patchedVersion, actualVersion); } install.Uninstall(); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_ForwardCompatibleInstallV1UninstallV1() { string providerId = String.Concat("~", this.TestContext.TestName, "_BundleA"); string parent = "~BundleAv1"; string parentSwitch = String.Concat("-parent ", parent); string packageA = this.GetPackageA().Output; string packageAv2 = this.GetPackageAv2().Output; string bundleA = this.GetBundleA().Output; string bundleAv2 = this.GetBundleAv2().Output; // Install the v2 bundle. BundleInstaller installerAv2 = new BundleInstaller(this, bundleAv2).Install(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageAv2)); string actualProviderVersion; Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual(V2, actualProviderVersion); // Install the v1 bundle with a parent which should passthrough to v2. BundleInstaller installerAv1 = new BundleInstaller(this, bundleA).Install(arguments: parentSwitch); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageAv2)); Assert.IsTrue(this.DependencyDependentExists(providerId, parent)); // Uninstall the v1 bundle with the same parent which should passthrough to v2 and remove parent. installerAv1.Uninstall(arguments: parentSwitch); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageAv2)); Assert.IsFalse(this.DependencyDependentExists(providerId, parent)); // Uninstall the v2 bundle and all should be removed. installerAv2.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageAv2)); Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); this.CleanTestArtifacts = true; }
public void Burn_FeatureInstallUninstall() { // Build the packages. string packageA = new PackageBuilder(this, "A").Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; BundleInstaller install = new BundleInstaller(this, bundleA).Install(); // Source file should *not* be installed, main registry key should be present. string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Should not have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal("1.0.0.0", actualVersion); } // Now turn on the feature. this.SetPackageRequestedState("PackageA", RequestState.Present); this.SetPackageFeatureState("PackageA", "Test", FeatureState.Local); install.Modify(); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); this.ResetPackageStates("PackageA"); // Turn the feature back off. this.SetPackageRequestedState("PackageA", RequestState.Present); this.SetPackageFeatureState("PackageA", "Test", FeatureState.Absent); install.Modify(); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Should have removed Package A payload from: ", packageSourceCodeInstalled)); this.ResetPackageStates("PackageA"); // Uninstall everything. install.Uninstall(); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_ParentInstallTwiceThenUninstall() { // Build. string packageA = this.GetPackageA().Output; string bundleA = this.GetBundleA().Output; // Install the bundle with a parent, and ensure it is installed. BundleInstaller installerAFoo = new BundleInstaller(this, bundleA).Install(arguments: "-parent Foo"); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); // Install the bundle with a second parent, and ensure it is installed. BundleInstaller installerABar = new BundleInstaller(this, bundleA).Install(arguments: "-parent Bar"); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); // Attempt to uninstall bundle with first parent and ensure it is still installed. installerAFoo.Uninstall(arguments: "-parent Foo"); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); // Uninstall bundle with the second parent and ensure it is removed. installerABar.Uninstall(arguments: "-parent Bar"); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); this.Complete(); }
public void Burn_FailNonVitalPackage() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageC); // Build the bundle. string bundleE = new BundleBuilder(this, "BundleE") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundle and make sure packageA is installed. // SFBUG:3435047 - Make sure during install we don't fail for non-vital packages. BundleInstaller installerE = new BundleInstaller(this, bundleE).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the bundle. // SFBUG:3435047 - Make sure during repair we don't fail for the same reason in a different code path. installerE.Repair(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Uninstall the bundle and make sure packageA is uninstalled. installerE.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_InstallUninstallMajorUpgrade() { string v2Version = "2.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); bindPaths.Add("packageC", packageC); // Add the bindpath for the cab for C to enable to add it as a payload for BundleA bindPaths.Add("packageCcab", Path.Combine(Path.GetDirectoryName(packageC), "cab1.cab")); // Build the embedded bundle and the earlier version of the bundle. string bundleBv1 = new BundleBuilder(this, "BundleBv1") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleBv2 = new BundleBuilder(this, "BundleBv2") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", v2Version } } }.Build().Output; // Build the parent bundle. bindPaths.Add("bundleBv2", bundleBv2); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", v2Version } } }.Build().Output; // Install Bv1 BundleInstaller installerBv1 = new BundleInstaller(this, bundleBv1).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // Install the bundle containing the upgraded embedded bundle. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.False(MsiVerifier.IsPackageInstalled(packageB)); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageC)); // Attempt to uninstall bundleA, which will uninstall bundleBv2 since it is a patch related bundle. installerA.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.False(MsiVerifier.IsPackageInstalled(packageC)); this.Complete(); }
public void Burn_SlipstreamRepair() { const string patchedVersion = V101; string bundleA = this.GetBundleA().Output; BundleInstaller install = new BundleInstaller(this, bundleA).Install(); string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } // Delete the installed file and registry key. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } // Repair and verify the repair fixed everything. install.Repair(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload repaired at: ", packageSourceCodeInstalled)); // Clean up. install.Uninstall(); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_SlipstreamReverseRepairOnlyPatch() { const string unpatchedVersion = "1.0.0.0"; const string patchedVersion = V101; // Create the bundle with only teh package and a bundle that slipstreams the package and bundle. string bundleOnlyA = this.GetBundleOnlyA().Output; string bundleA = this.GetBundleAReverse().Output; // Install the package. BundleInstaller installOnlyPackage = new BundleInstaller(this, bundleOnlyA).Install(); // Verify the package is installed correctly. string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(unpatchedVersion, actualVersion); } // Delete the installed file and registry key so we have something to repair. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } // "Install" the bundle but force everything to be a repair. this.SetPackageRequestedState("packageA", RequestState.Repair); this.SetPackageRequestedState("patchA", RequestState.Repair); BundleInstaller install = new BundleInstaller(this, bundleA).Install(); packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } // Clean up. this.ResetPackageStates("packageA"); this.ResetPackageStates("patchA"); install.Uninstall(); packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(unpatchedVersion, actualVersion); } installOnlyPackage.Uninstall(); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_InstallUninstallAddonPatchRelatedBundle() { // Build the packages. string packageA = new PackageBuilder(this, "A").Build().Output; string packageC1 = new PackageBuilder(this, "C").Build().Output; string packageC2 = new PackageBuilder(this, "C") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", "1.0.1.0" } } }.Build().Output; string packageD = new PackageBuilder(this, "D").Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageC", packageC1); bindPaths.Add("packageD", packageD); // Build the base and addon bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Update path to C2 and build the addon patch bundle. bindPaths["packageC"] = packageC2; string bundleE = new BundleBuilder(this, "BundleE") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", "1.0.1.0" } } }.Build().Output; // Install the base and addon bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); // Test that packages A and C1 but not D are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Install the patch to the addon. BundleInstaller installerE = new BundleInstaller(this, bundleE).Install(); // Test that packages A and C2 but not D are installed, and that C1 was upgraded. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Attempt to uninstall bundleA. installerA.Uninstall(); // Test that uninstalling bundle A detected and removed bundle C, which removed bundle E (can't easily reference log). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Remove")); // Test that all packages are uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC2)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); this.CleanTestArtifacts = true; }
public void Burn_AutomaticSlipstreamInstallUninstall() { const string originalVersion = "1.0.0.0"; const string patchedVersion = "1.0.1.0"; // Build the packages. string packageA = this.GetPackageA().Output; string packageAUpdate = this.GetPackageAv101().Output; string packageB = this.GetPackageB().Output; string packageBUpdate = new PackageBuilder(this, "B") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { packageA, packageB }, UpgradePaths = new string[] { packageAUpdate, packageBUpdate } }.Build().Output; string patchB = new PatchBuilder(this, "PatchB") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { packageA, packageB }, UpgradePaths = new string[] { packageAUpdate, packageBUpdate } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); bindPaths.Add("patchA", patchA); bindPaths.Add("patchB", patchB); string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; BundleInstaller install = new BundleInstaller(this, bundleC).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { // Product A should've slipstreamed both patches. string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); actualVersion = root.GetValue("A2") as string; Assert.Equal(patchedVersion, actualVersion); // Product B should've only slipstreamed patch B. actualVersion = root.GetValue("B") as string; Assert.Equal(originalVersion, actualVersion); actualVersion = root.GetValue("B2") as string; Assert.Equal(patchedVersion, actualVersion); } install.Uninstall(); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_UninstallAddonBundle() { const string expectedVersion = "1.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleA2 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleF = new BundleBuilder(this, "BundleF") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure all packages are installed. BundleInstaller installerF = new BundleInstaller(this, bundleF).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Install an addon bundle and make sure all packages are installed. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Install a second addon bundle and make sure all packages are installed. BundleInstaller installerA2 = new BundleInstaller(this, bundleA2).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the base bundle and make sure all packages are uninstalled. installerF.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_InstallPatchBundle() { const string expectedVersion = "1.0.1.0"; // Build the packages. string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA2 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion } }, NeverGetsInstalled = true }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion } }, TargetPath = packageA1, UpgradePath = packageA2 }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageB", packageB); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleF = new BundleBuilder(this, "BundleF") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleG = new BundleBuilder(this, "BundleG") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure all packages are installed. BundleInstaller installerF = new BundleInstaller(this, bundleF).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Install patch bundle and make sure all packages are installed. BundleInstaller installerG = new BundleInstaller(this, bundleG).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // Uninstall the base bundle and make sure all packages are uninstalled. installerF.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); this.CleanTestArtifacts = true; }
public void Burn_UninstallUpgradedBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Override the path for A to A1. bindPaths["packageA"] = packageA1; string bundleA1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // Make sure the MSIs and EXE are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Attempt to upgrade bundleA. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(); // Verify packageA1 was installed and packageA was uninstalled. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion2, actualVersion); } // Uninstall bundleA1 and verify that packageA1 is still installed. installerA1.Uninstall(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); // Uninstall bundleB now. installerB.Uninstall(); // BUG: BundleB does not know about PackageA1 (A,v2), so remove it explicitly (SFBUG:3307315). MSIExec.UninstallProduct(packageA1, MSIExec.MSIExecReturnCode.SUCCESS); // Make sure the MSIs are not installed. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_InstallUpgradeSlipstreamBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } }, TargetPath = packageA, UpgradePath = packageA1 }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Install the upgrade bundle with a slipstreamed patch and make sure the patch is installed. // SFBUG:3387046 - Uninstalling bundle registers a dependency on a package BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // BundleC doesn't carry the EXE, so make sure it's removed. using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the upgrade bundle to make sure it does not prompt for source. // SFBUG:3386927 - MSIs get removed from cache during upgrade installerC.Repair(); // Uninstall the slipstream bundle and make sure both packages are uninstalled. installerC.Uninstall(); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); this.CleanTestArtifacts = true; }
public void Burn_UpdateInstalledPerUserBundleUpdateServerCurrentFeed() { // Build the package. string packageB1 = this.GetPackageB().Output; // Build the bundle. string bundleB1 = this.GetBundleB().Output; // Install the v1 bundle. BundleInstaller installerB1 = new BundleInstaller(this, bundleB1).Install(); // Test that v1 was correctly installed. Assert.True(MsiVerifier.IsPackageInstalled(packageB1)); HostConfiguration hostConfigs = new HostConfiguration() { UrlReservations = new UrlReservations() { CreateAutomatically = true }, AllowChunkedEncoding = false // https://github.com/NancyFx/Nancy/issues/1337 }; string rootDirectory = FileUtilities.GetUniqueFileName(); this.TestArtifacts.Add(new DirectoryInfo(rootDirectory)); Directory.CreateDirectory(Path.Combine(rootDirectory, "1.0")); // Copy v1.0 artifacts to the TestDataDirectory File.Copy(bundleB1, Path.Combine(rootDirectory, "1.0", Path.GetFileName(bundleB1)), true); File.Copy(Path.Combine(this.TestContext.TestDataDirectory, "FeedBv1.0.xml"), Path.Combine(rootDirectory, "1.0", "FeedBv1.0.xml"), true); RootPathProvider.RootPath = rootDirectory; // Verify bundle asking for update and getting a current feed doesn't update and doesn't modify state FeedModule.FeedBehavior = FeedModule.UpdateFeedBehavior.Version1; using (NancyHost nancyHost = new NancyHost(this.UpdateUri, new ApplicationBootstrapper(), hostConfigs) { }) { nancyHost.Start(); // Run the v1 bundle providing an update bundle. installerB1.Modify(arguments: new string[] { "-checkupdate" }); // The modify -> update is asynchronous, so we need to wait until the real BundleB is done System.Diagnostics.Process[] childBundles = System.Diagnostics.Process.GetProcessesByName(Path.GetFileNameWithoutExtension(bundleB1)); foreach (var childBundle in childBundles) { childBundle.WaitForExit(); } } // Test that only v1 packages is installed. Assert.True(MsiVerifier.IsPackageInstalled(packageB1)); // Attempt to uninstall v1. installerB1.Uninstall(); // Test all packages are uninstalled. Assert.False(MsiVerifier.IsPackageInstalled(packageB1)); Assert.Null(this.GetTestRegistryRoot()); this.Complete(); }
public void Burn_InstallUpdatedBundleOptionalUpdateRegistration() { string v2Version = "2.0.0.0"; // Build the packages. string packageAv1 = new PackageBuilder(this, "A").Build().Output; string packageAv2 = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", v2Version } } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPathsv1 = new Dictionary <string, string>() { { "packageA", packageAv1 } }; Dictionary <string, string> bindPathsv2 = new Dictionary <string, string>() { { "packageA", packageAv2 } }; // Build the bundles. string bundleAv1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPathsv1, Extensions = Extensions }.Build().Output; string bundleAv2 = new BundleBuilder(this, "BundleA") { BindPaths = bindPathsv2, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", v2Version } } }.Build().Output; // Initialize with first bundle. BundleInstaller installerAv1 = new BundleInstaller(this, bundleAv1).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageAv1)); // Make sure the OptionalUpdateRegistration exists. // SOFTWARE\[Manufacturer]\Updates\[ProductFamily]\[Name] using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft Corporation\Updates\~Burn_InstallUpdatedBundleOptionalUpdateRegistration - Bundle A")) { Assert.Equal("Y", key.GetValue("ThisVersionInstalled")); Assert.Equal("1.0.0.0", key.GetValue("PackageVersion")); } // Install second bundle which will major upgrade away v1. BundleInstaller installerAv2 = new BundleInstaller(this, bundleAv2).Install(); Assert.False(MsiVerifier.IsPackageInstalled(packageAv1)); Assert.True(MsiVerifier.IsPackageInstalled(packageAv2)); // Make sure the OptionalUpdateRegistration exists. // SOFTWARE\[Manufacturer]\Updates\[ProductFamily]\[Name] using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft Corporation\Updates\~Burn_InstallUpdatedBundleOptionalUpdateRegistration - Bundle A")) { Assert.Equal("Y", key.GetValue("ThisVersionInstalled")); Assert.Equal("2.0.0.0", key.GetValue("PackageVersion")); } // Uninstall the second bundle and everything should be gone. installerAv2.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageAv1)); Assert.False(MsiVerifier.IsPackageInstalled(packageAv2)); // Make sure the key is removed. using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft Corporation\Updates\~Burn_InstallUpdatedBundleOptionalUpdateRegistration - Bundle A")) { Assert.Null(key); } }
public void Burn_PatchOnePackageTwoPatches() { string originalVersion = "1.0.0.0"; string patchedVersion = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output; string patchA2 = new PatchBuilder(this, "PatchA2") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("patchA", patchA); bindPaths.Add("patchA2", patchA2); string bundlePatch = new BundleBuilder(this, "PatchBundleA2") { BindPaths = bindPaths, Extensions = WixTests.Extensions, SuppressPatchSequenceData = true }.Build().Output; // Install the original MSI and ensure the registry keys that get patched are as expected. MSIExec.InstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); actualVersion = root.GetValue("A2") as string; Assert.Equal(originalVersion, actualVersion); } // Install the bundle of patches and ensure all the registry keys are updated. BundleInstaller installPatches = new BundleInstaller(this, bundlePatch).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); actualVersion = root.GetValue("A2") as string; Assert.Equal(patchedVersion, actualVersion); } // Uninstall the patch bundle and verify the keys go back to original values. installPatches.Uninstall(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); actualVersion = root.GetValue("A2") as string; Assert.Equal(originalVersion, actualVersion); } this.Complete(); }
public void Burn_InstallUninstallStickyAddonRelatedBundle() { // Build the packages. string packageA = new PackageBuilder(this, "A").Build().Output; string packageB = new PackageBuilder(this, "B").Build().Output; string packageC = new PackageBuilder(this, "C").Build().Output; string packageD = new PackageBuilder(this, "D").Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); bindPaths.Add("packageC", packageC); bindPaths.Add("packageD", packageD); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); // Make sure that bundle C detected dependent bundle A. Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerC.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Dependent, scope: PerMachine, version: 1\.0\.0\.0, operation: None")); // Test that packages A and C but not D are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Install bundle B (tests sticky addons). BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Install")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Detect, scope: PerMachine, version: 1\.0\.0\.0, operation: None")); // Test that all packages are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD)); // Attempt to uninstall bundleA. installerA.Uninstall(); // Test that packageA is still installed (ref-counted). Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); // Test that uninstalling bundle A detected bundle C (ref-counted). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Remove")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Will not uninstall package: \{[0-9A-Za-z\-]{36}\}, found dependents: 1")); // Attempt to uninstall bundleB. installerB.Uninstall(); // Test that all packages are uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Test that uninstalling bundle B detected and removed bundle C (ref-counted). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Remove")); this.CleanTestArtifacts = true; }
public void Burn_DifferentPackageRequestStates() { const string expectedVersion = "1.0.0.0"; // Build the package. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // SFBUG:3469206 - install a bundle without installing the shared package, which should not be ref-counted. this.SetPackageRequestedState("PackageA", RequestState.None); // Also don't install packageB since it has an authored dependency on packageA and would fail this test case. this.SetPackageRequestedState("PackageB", RequestState.None); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the first bundle and make sure packageA is uninstalled. this.ResetPackageStates("PackageA"); installerA.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the second bundle and make sure all packages are uninstalled. installerB.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } this.CleanTestArtifacts = true; }
public void Burn_UninstallAddonBundle() { const string expectedVersion = "1.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleA2 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleF = new BundleBuilder(this, "BundleF") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure all packages are installed. BundleInstaller installerF = new BundleInstaller(this, bundleF).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Install an addon bundle and make sure all packages are installed. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Install a second addon bundle and make sure all packages are installed. BundleInstaller installerA2 = new BundleInstaller(this, bundleA2).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the base bundle and make sure all packages are uninstalled. installerF.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_MixedScopeUpgradedBundle() { const string upgradeVersion = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageD1 = new PackageBuilder(this, "D") { Extensions = Extensions }.Build().Output; string packageD2 = new PackageBuilder(this, "D") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", upgradeVersion } } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageD", packageD1); // Build the base bundle. string bundleH1 = new BundleBuilder(this, "BundleH") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Override the path for D1 to D2 and build the upgrade bundle. bindPaths["packageD"] = packageD2; string bundleH2 = new BundleBuilder(this, "BundleH") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", upgradeVersion } } }.Build().Output; // Install the base bundle. BundleInstaller installerH1 = new BundleInstaller(this, bundleH1).Install(); // Make sure the MSIs are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD1)); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH1.LastLogFile, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); // Install the upgrade bundle. Verify the base bundle was removed. BundleInstaller installerH2 = new BundleInstaller(this, bundleH2).Install(); // Verify packageD2 was installed and packageD1 was uninstalled. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD2)); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH2.LastLogFile, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH2.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerUser, version: 1\.0\.0\.0, operation: MajorUpgrade")); // Uninstall the upgrade bundle now. installerH2.Uninstall(); // Verify that permanent packageA is still installed and then remove. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); MSIExec.UninstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS); // Make sure the MSIs were uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD2)); this.CleanTestArtifacts = true; }
public void Burn_MajorUpgradeWithSlipstream() { const string originalVersion = "1.0.0.0"; const string upgradeVersion = "2.0.0.0"; const string patchedVersion = "2.0.1.0"; // Build the packages. string originalPackageA = this.GetPackageA().Output; string upgradePackageA = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", upgradeVersion } }, }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { upgradePackageA }, UpgradePaths = new string[] { packageAUpdate } }.Build().Output; // Create the named bind paths to the packages in the bundle. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", upgradePackageA); bindPaths.Add("patchA", patchA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the original MSI. MSIExec.InstallProduct(originalPackageA, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(MsiVerifier.IsPackageInstalled(originalPackageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { // Original Product A should be present. string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); } // Now install the bundle that should upgrade the MSI and apply the patch. BundleInstaller install = new BundleInstaller(this, bundleA).Install(); Assert.False(MsiVerifier.IsPackageInstalled(originalPackageA)); Assert.True(MsiVerifier.IsPackageInstalled(upgradePackageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { // Product A should've slipstreamed with its patch. string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } install.Uninstall(); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_UninstallBundleWithDependent() { const string expectedVersion = "1.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // Make sure the MSIs and EXE are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Attempt to uninstall bundleA. installerA.Uninstall(); // Verify packageA and ExeA are still installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall bundleB now. installerB.Uninstall(); // Make sure the MSIs are installed. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_SlipstreamRemovePatchAlone() { const string patchedVersion = V101; string bundleA = this.GetBundleA().Output; BundleInstaller install = new BundleInstaller(this, bundleA).Install(); string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } // Remove only the slipstream patch and ensure the version is back to default. this.SetPackageRequestedState("patchA", RequestState.Absent); install.Modify(); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload *still* installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.True("1.0.0.0".Equals(actualVersion), "Patch A should have been removed and so the registry key would go back to default version."); } install.Uninstall(); // uninstall just to make sure no error occur removing the package without the patch. this.Complete(); }
public void Burn_UninstallUpgradedBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Override the path for A to A1. bindPaths["packageA"] = packageA1; string bundleA1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // Make sure the MSIs and EXE are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Attempt to upgrade bundleA. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(); // Verify packageA1 was installed and packageA was uninstalled. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion2, actualVersion); } // Uninstall bundleA1 and verify that packageA1 is still installed. installerA1.Uninstall(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); // Uninstall bundleB now. installerB.Uninstall(); // BUG: BundleB does not know about PackageA1 (A,v2), so remove it explicitly (SFBUG:3307315). MSIExec.UninstallProduct(packageA1, MSIExec.MSIExecReturnCode.SUCCESS); // Make sure the MSIs are not installed. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_SlipstreamReverseRepair() { const string patchedVersion = V101; string bundleA = this.GetBundleAReverse().Output; // Ensure the patch is not installed when the bundle installs. BundleInstaller install = new BundleInstaller(this, bundleA).Install(); string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.True(patchedVersion == actualVersion, "Patch A should not have been installed."); } // Repair the bundle and send the patch along for the ride. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } install.Repair(); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload *still* installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.True(patchedVersion.Equals(actualVersion), "Patch A should have been installed during the repair."); } install.Uninstall(); // uninstall just to make sure no error occur removing the package without the patch. Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_RedirectPackageCache() { const string PolicyName = "PackageCache"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; RegistryKey policy = Registry.LocalMachine.CreateSubKey(@"Software\Policies\WiX\Burn"); string currentPackageCache = null; try { currentPackageCache = policy.GetValue(PolicyName) as string; // Install the first bundle using the default package cache. policy.DeleteValue(PolicyName); BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); // Install the second bundle which has a shared package using the redirected package cache. string path = Path.Combine(Path.GetTempPath(), "Package Cache"); policy.SetValue(PolicyName, path); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); // The first bundle should leave package A behind. installerA.Uninstall(); // Now make sure that the second bundle removes packages from either cache directory. installerB.Uninstall(); this.Complete(); } finally { if (!string.IsNullOrEmpty(currentPackageCache)) { policy.SetValue(PolicyName, currentPackageCache); } else { policy.DeleteValue(PolicyName); } policy.Dispose(); } }
public void Burn_MajorUpgradeWithSlipstream() { const string originalVersion = "1.0.0.0"; const string upgradeVersion = "2.0.0.0"; const string patchedVersion = "2.0.1.0"; // Build the packages. string originalPackageA = this.GetPackageA().Output; string upgradePackageA = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", upgradeVersion } }, }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, TargetPaths = new string[] { upgradePackageA }, UpgradePaths = new string[] { packageAUpdate } }.Build().Output; // Create the named bind paths to the packages in the bundle. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", upgradePackageA); bindPaths.Add("patchA", patchA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the original MSI. MSIExec.InstallProduct(originalPackageA, MSIExec.MSIExecReturnCode.SUCCESS); Assert.True(MsiVerifier.IsPackageInstalled(originalPackageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { // Original Product A should be present. string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); } // Now install the bundle that should upgrade the MSI and apply the patch. BundleInstaller install = new BundleInstaller(this, bundleA).Install(); Assert.False(MsiVerifier.IsPackageInstalled(originalPackageA)); Assert.True(MsiVerifier.IsPackageInstalled(upgradePackageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { // Product A should've slipstreamed with its patch. string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } install.Uninstall(); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_SlipstreamRepairOnlyPatch() { const string unpatchedVersion = "1.0.0.0"; const string patchedVersion = V101; // Create the bundle with only teh package and a bundle that slipstreams the package and bundle. string bundleOnlyA = this.GetBundleOnlyA().Output; string bundleA = this.GetBundleA().Output; // Install the package. BundleInstaller installOnlyPackage = new BundleInstaller(this, bundleOnlyA).Install(); // Verify the package is installed correctly. string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.IsTrue(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(unpatchedVersion, actualVersion); } // Delete the installed file and registry key so we have something to repair. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } // "Install" the bundle but force everything to be a repair. this.SetPackageRequestedState("packageA", RequestState.Repair); this.SetPackageRequestedState("patchA", RequestState.Repair); BundleInstaller install = new BundleInstaller(this, bundleA).Install(); packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.IsTrue(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(patchedVersion, actualVersion); } // Clean up. this.ResetPackageStates("packageA"); this.ResetPackageStates("patchA"); install.Uninstall(); packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.IsTrue(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(unpatchedVersion, actualVersion); } installOnlyPackage.Uninstall(); Assert.IsFalse(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.IsNull(this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.CleanTestArtifacts = true; }
public void Burn_UninstallUpgradedBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Override the path for A to A1. bindPaths["packageA"] = packageA1; string bundleA1 = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // Make sure the MSIs and EXE are installed. Assert.True(MsiVerifier.IsPackageInstalled(packageA)); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.Equal(expectedVersion1, actualVersion); } // Attempt to upgrade bundleA. BundleInstaller installerA1 = new BundleInstaller(this, bundleA1).Install(); // Verify packageA1 was installed and packageA was uninstalled. Assert.True(MsiVerifier.IsPackageInstalled(packageA1)); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.Equal(expectedVersion2, actualVersion); } // Uninstall bundleA1 and verify that packageA1 is still installed. installerA1.Uninstall(); Assert.True(MsiVerifier.IsPackageInstalled(packageA1)); // Uninstall bundleB now. // // SFBUG:3307315, or (new) 2555 - Detect for upgraded package also. installerB.Uninstall(); // Make sure the MSIs are not installed. Assert.False(MsiVerifier.IsPackageInstalled(packageB)); Assert.False(MsiVerifier.IsPackageInstalled(packageA1)); Assert.False(MsiVerifier.IsPackageInstalled(packageA)); Assert.Null(this.GetTestRegistryRoot()); this.Complete(); }
public void Burn_InstallUpgradeSlipstreamBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } }, TargetPath = packageA, UpgradePath = packageA1 }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Install the upgrade bundle with a slipstreamed patch and make sure the patch is installed. // SFBUG:3387046 - Uninstalling bundle registers a dependency on a package BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // BundleC doesn't carry the EXE, so make sure it's removed. using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the upgrade bundle to make sure it does not prompt for source. // SFBUG:3386927 - MSIs get removed from cache during upgrade installerC.Repair(); // Uninstall the slipstream bundle and make sure both packages are uninstalled. installerC.Uninstall(); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); this.CleanTestArtifacts = true; }
public void Burn_ForwardCompatiblePerUserParentTwiceMajorUpgrade() { string providerId = String.Concat("~", this.TestContext.TestName, "_BundleC"); string parent = "~BundleCv1"; string parent2 = "~BundleCv1_Parent2"; string parentSwitch = String.Concat("-parent ", parent); string parent2Switch = String.Concat("-parent ", parent2); // Build. string packageC = this.GetPackageC().Output; string packageCv2 = this.GetPackageCv2().Output; string bundleC = this.GetBundleC().Output; string bundleCv2 = this.GetBundleCv2().Output; // Install the v1 bundle with a parent. BundleInstaller installerCv1 = new BundleInstaller(this, bundleC).Install(arguments: parentSwitch); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2)); string actualProviderVersion; Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual("1.0.0.0", actualProviderVersion); Assert.IsTrue(this.DependencyDependentExists(providerId, parent)); // Install the v1 bundle with a second parent. installerCv1.Install(arguments: parent2Switch); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2)); Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual("1.0.0.0", actualProviderVersion); Assert.IsTrue(this.DependencyDependentExists(providerId, parent)); // Upgrade with the v2 bundle. BundleInstaller installerCv2 = new BundleInstaller(this, bundleCv2).Install(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2)); Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual(V2, actualProviderVersion); Assert.IsTrue(this.DependencyDependentExists(providerId, parent)); // Uninstall the v2 bundle and nothing should happen because there is still a parent. installerCv2.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2)); Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual(V2, actualProviderVersion); Assert.IsTrue(this.DependencyDependentExists(providerId, parent)); // Uninstall one parent of the v1 bundle and nothing should happen because there is still a parent. installerCv1.Uninstall(arguments: parentSwitch); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2)); Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); Assert.AreEqual(V2, actualProviderVersion); Assert.IsTrue(this.DependencyDependentExists(providerId, parent2)); // Uninstall the v1 bundle with passthrough with second parent and all should be removed. installerCv1.Uninstall(arguments: parent2Switch); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2)); Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion)); this.CleanTestArtifacts = true; }
public void Burn_DifferentPackageRequestStates() { const string expectedVersion = "1.0.0.0"; // Build the package. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // SFBUG:3469206 - install a bundle without installing the shared package, which should not be ref-counted. this.SetPackageRequestedState("PackageA", RequestState.None); // Also don't install packageB since it has an authored dependency on packageA and would fail this test case. this.SetPackageRequestedState("PackageB", RequestState.None); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the first bundle and make sure packageA is uninstalled. this.ResetPackageStates("PackageA"); installerA.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall the second bundle and make sure all packages are uninstalled. installerB.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } this.CleanTestArtifacts = true; }
public void Burn_InstallPatchBundle() { const string expectedVersion = "1.0.1.0"; // Build the packages. string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA2 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion } }, NeverGetsInstalled = true }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion } }, TargetPath = packageA1, UpgradePath = packageA2 }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageB", packageB); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleF = new BundleBuilder(this, "BundleF") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleG = new BundleBuilder(this, "BundleG") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure all packages are installed. BundleInstaller installerF = new BundleInstaller(this, bundleF).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Install patch bundle and make sure all packages are installed. BundleInstaller installerG = new BundleInstaller(this, bundleG).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // Uninstall the base bundle and make sure all packages are uninstalled. installerF.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); this.CleanTestArtifacts = true; }
public void Burn_InstallUninstallStickyPatchRelatedBundle() { const string patchVersion = "1.0.1.0"; // Build the packages. string packageA1 = new PackageBuilder(this, "A").Build().Output; string packageA2 = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion } }, NeverGetsInstalled = true }.Build().Output; string packageB1 = new PackageBuilder(this, "B").Build().Output; string packageB2 = new PackageBuilder(this, "B") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion } }, TargetPaths = new string[] { packageA1, packageB1 }, UpgradePaths = new string[] { packageA2, packageB2 } }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageB", packageB1); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleD = new BundleBuilder(this, "BundleD") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion } }, BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerD = new BundleInstaller(this, bundleD).Install(); // Make sure that bundle D detected dependent bundle A. Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerD.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Dependent, scope: PerMachine, version: 1\.0\.0\.0, operation: None")); // Test that packageA1 and patchA are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(patchVersion, actualVersion); } // Install bundle B (tests sticky patching). BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Patch, scope: PerMachine, version: 1\.0\.1\.0, operation: Install")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Detect, scope: PerMachine, version: 1\.0\.0\.0, operation: None")); // Test that packageB and patchA are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB1)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("B") as string; Assert.AreEqual(patchVersion, actualVersion); } // Attempt to uninstall bundleA. installerA.Uninstall(); // Test that packageA is still installed (ref-counted). Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); // Test that uninstalling bundle A detected bundle D (ref-counted). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Patch, scope: PerMachine, version: 1\.0\.1\.0, operation: Remove")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Will not uninstall package: \{[0-9A-Za-z\-]{36}\}, found dependents: 1")); // Attempt to uninstall bundleB. installerB.Uninstall(); // Test that all packages are uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB1)); Assert.IsNull(this.GetTestRegistryRoot()); // Test that uninstalling bundle B detected and removed bundle D (ref-counted). Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerB.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Patch, scope: PerMachine, version: 1\.0\.1\.0, operation: Remove")); this.CleanTestArtifacts = true; }
public void Burn_MixedScopeUpgradedBundle() { const string upgradeVersion = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageD1 = new PackageBuilder(this, "D") { Extensions = Extensions }.Build().Output; string packageD2 = new PackageBuilder(this, "D") { Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", upgradeVersion } } }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageD", packageD1); // Build the base bundle. string bundleH1 = new BundleBuilder(this, "BundleH") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Override the path for D1 to D2 and build the upgrade bundle. bindPaths["packageD"] = packageD2; string bundleH2 = new BundleBuilder(this, "BundleH") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", upgradeVersion } } }.Build().Output; // Install the base bundle. BundleInstaller installerH1 = new BundleInstaller(this, bundleH1).Install(); // Make sure the MSIs are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD1)); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH1.LastLogFile, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); // Install the upgrade bundle. Verify the base bundle was removed. BundleInstaller installerH2 = new BundleInstaller(this, bundleH2).Install(); // Verify packageD2 was installed and packageD1 was uninstalled. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageD2)); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH2.LastLogFile, @"Skipping cross-scope dependency registration on package: PackageA, bundle scope: PerUser, package scope: PerMachine")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerH2.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerUser, version: 1\.0\.0\.0, operation: MajorUpgrade")); // Uninstall the upgrade bundle now. installerH2.Uninstall(); // Verify that permanent packageA is still installed and then remove. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); MSIExec.UninstallProduct(packageA, MSIExec.MSIExecReturnCode.SUCCESS); // Make sure the MSIs were uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD2)); this.CleanTestArtifacts = true; }
public void Burn_PatchInstallUninstall() { string originalVersion = "1.0.0.0"; string patchedVersion = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = WixTests.Extensions }.Build().Output; string bundleAPatch = new BundleBuilder(this, "PatchBundleA") { BindPaths = bindPaths, Extensions = WixTests.Extensions }.Build().Output; // Install the unpatched bundle. BundleInstaller installA = new BundleInstaller(this, bundleA).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); } // Install the patch bundle. BundleInstaller installAPatch = new BundleInstaller(this, bundleAPatch).Install(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } // Uninstall the patch bundle. installAPatch.Uninstall(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); } installA.Uninstall(); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_RollbackUpgradeBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleD = new BundleBuilder(this, "BundleD") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Install the upgrade bundle that will fail and rollback. Make sure packageA is still present. // SFBUG:3405221 - pkg dependecy not removed in rollback if pkg already present BundleInstaller installerD = new BundleInstaller(this, bundleD).Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Uninstall the first bundle and make sure packageA is uninstalled. installerA.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_PatchTag() { string originalVersion = "1.0.0.0"; string patchedVersion = "1.0.1.0"; string actualVersion = null; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions }.Build().Output; string packageAUpdate = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = WixTests.Extensions }.Build().Output; string bundleAPatch = new BundleBuilder(this, "PatchBundleA") { BindPaths = bindPaths, Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchedVersion } } }.Build().Output; // Install the unpatched bundle. BundleInstaller installA = new BundleInstaller(this, bundleA).Install(); actualVersion = GetTagVersion("~Burn_PatchTag - Bundle A"); Assert.Equal(originalVersion, actualVersion); actualVersion = GetTagVersion("~Burn_PatchTag - A"); Assert.Equal(originalVersion, actualVersion); // Install the patch bundle. BundleInstaller installAPatch = new BundleInstaller(this, bundleAPatch).Install(); actualVersion = GetTagVersion("~Burn_PatchTag - Patch Bundle A"); Assert.Equal(patchedVersion, actualVersion); actualVersion = GetTagVersion("~Burn_PatchTag - A"); Assert.Equal(patchedVersion, actualVersion); // Uninstall the patch bundle. installAPatch.Uninstall(); actualVersion = GetTagVersion("~Burn_PatchTag - A"); Assert.Equal(originalVersion, actualVersion); // Uninstall the original bundle and ensure all the tags are gone. installA.Uninstall(); actualVersion = GetTagVersion("~Burn_PatchTag - Bundle A"); Assert.Null(actualVersion); actualVersion = GetTagVersion("~Burn_PatchTag - A"); Assert.Null(actualVersion); this.Complete(); }
public void Burn_UninstallBundleWithDependent() { const string expectedVersion = "1.0.0.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleB = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); // Make sure the MSIs and EXE are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Attempt to uninstall bundleA. installerA.Uninstall(); // Verify packageA and ExeA are still installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion, actualVersion); } // Uninstall bundleB now. installerB.Uninstall(); // Make sure the MSIs are installed. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_InstallUninstallUpgradePatchRelatedBundleWithAddon() { const string patchVersion1 = "1.0.1.0"; const string patchVersion2 = "1.0.2.0"; // Build the packages. string packageA1 = new PackageBuilder(this, "A").Build().Output; string packageA2 = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion1 } }, NeverGetsInstalled = true }.Build().Output; string packageA3 = new PackageBuilder(this, "A") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion2 } }, NeverGetsInstalled = true }.Build().Output; string packageC = new PackageBuilder(this, "C").Build().Output; string packageD = new PackageBuilder(this, "D").Build().Output; string patchA1 = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion1 } }, TargetPath = packageA1, UpgradePath = packageA2 }.Build().Output; string patchA2 = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion2 } }, TargetPath = packageA1, UpgradePath = packageA3 }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageC", packageC); bindPaths.Add("packageD", packageD); bindPaths.Add("patchA", patchA1); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleD1 = new BundleBuilder(this, "BundleD") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion1 } }, BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Build the v2 patch bundle. bindPaths["patchA"] = patchA2; string bundleD2 = new BundleBuilder(this, "BundleD") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", patchVersion2 } }, BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundles. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); BundleInstaller installerD1 = new BundleInstaller(this, bundleD1).Install(); // Test both packages are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(patchVersion1, actualVersion); } // Install the addon bundle. BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); // Test that package C but not D is installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); // Install the v2 patch bundles. BundleInstaller installerD2 = new BundleInstaller(this, bundleD2).Install(); // Test that all packages but D are installed. Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.AreEqual(patchVersion2, actualVersion); } // Test that installing D2 upgrades D1. Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerD2.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Upgrade, scope: PerMachine, version: 1\.0\.1\.0, operation: MajorUpgrade")); // Attempt to uninstall bundleA. installerA.Uninstall(); // Test that uninstalling bundle A detected and would remove bundles C and D. Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Addon, scope: PerMachine, version: 1\.0\.0\.0, operation: Remove")); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerA.LastLogFile, @"Detected related bundle: \{[0-9A-Za-z\-]{36}\}, type: Patch, scope: PerMachine, version: 1\.0\.2\.0, operation: Remove")); // Test all packages are uninstalled. Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageD)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_MissingNonVitalPackage() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageB); // Build the bundle. string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Delete the non-vital package to force the ignorable failure. File.Delete(Path.Combine(Path.GetDirectoryName(bundleC), "~Burn_MissingNonVitalPackage_PackageA.msi")); // Install the bundle. BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsTrue(LogVerifier.MessageInLogFileRegex(installerC.LastLogFile, "Skipping apply of package: PackageA due to cache error: 0x80070002. Continuing...")); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Uninstall bundle. installerC.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); this.CleanTestArtifacts = true; }
public void Burn_SharedMinorUpgrade() { string productCode = Guid.NewGuid().ToString("B").ToUpperInvariant(); string originalVersion = "1.0.0.0"; string v11Version = "1.0.1.0"; var processorVariables = new Dictionary <string, string>() { { "ProductCode", productCode } }; var processorVariablesV11 = new Dictionary <string, string>() { { "ProductCode", productCode }, { "Version", v11Version } }; // Build the packages. string packageAv1 = this.CreatePackage("A", preprocessorVariables: processorVariables).Output; string packageAv11 = this.CreatePackage("A", preprocessorVariables: processorVariablesV11).Output; string packageB = this.CreatePackage("B").Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPathsA = new Dictionary <string, string>() { { "packageA", packageAv1 } }; Dictionary <string, string> bindPathsB = new Dictionary <string, string>() { { "packageA", packageAv11 }, { "packageB", packageB } }; // Build the bundles. string bundleA = this.CreateBundle("BundleA", bindPathsA).Output; string bundleB = this.CreateBundle("BundleB", bindPathsB).Output; // Initialize with first bundle. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.True(MsiVerifier.IsProductInstalled(productCode)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(originalVersion, actualVersion); } // Install second bundle which will minor upgrade . BundleInstaller installerB = new BundleInstaller(this, bundleB).Install(); Assert.True(MsiVerifier.IsPackageInstalled(packageB)); Assert.True(MsiVerifier.IsProductInstalled(productCode)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(v11Version, actualVersion); } // Uninstall the second bundle and only the minor upgrade MSI should be left. installerB.Uninstall(); Assert.False(MsiVerifier.IsPackageInstalled(packageB)); Assert.True(MsiVerifier.IsProductInstalled(productCode)); using (var root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(v11Version, actualVersion); } // Now everything should be gone. installerA.Uninstall(); Assert.False(MsiVerifier.IsProductInstalled(productCode)); this.Completed(); }