示例#1
0
        protected BundleInstaller CreateBundleInstaller(string name)
        {
            var installer = new BundleInstaller(this.TestContext, name);

            this.Installers.Push(installer);
            return(installer);
        }
示例#2
0
        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;
        }
示例#3
0
        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();
        }
示例#4
0
        public void Burn_CancelExecuteWhileCaching()
        {
            // 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 bundleA = new BundleBuilder(this, "BundleB") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;

            // Slow the caching of package B to ensure that package A starts installing and cancels.
            this.SetPackageCancelExecuteAtProgress("PackageA", 50);
            this.SetPackageSlowCache("PackageB", 1000);

            // Install the bundle and hopefully it fails.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(expectedExitCode: ErrorCodes.ERROR_INSTALL_USEREXIT);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB));

            this.CleanTestArtifacts = true;
        }
示例#5
0
        public void Burn_UpdateInstalledPerUserBundleNoUpdateServer()
        {
            // Build the packages.
            string packageB1 = this.GetPackageB().Output;

            // Build the bundles.
            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));


            // Run the v1 bundle requesting an update bundle.

            installerB1.Modify(arguments: new string[] { "-checkupdate" });
            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();
        }
示例#6
0
        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();
        }
示例#7
0
        public void Burn_CancelVeryLate()
        {
            // 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 bundleA = new BundleBuilder(this, "BundleA")
            {
                BindPaths = bindPaths, Extensions = Extensions
            }.Build().Output;

            // Cancel package B at the last moment possible..
            this.SetPackageCancelExecuteAtProgress("PackageB", 100);

            // Install the bundle and hopefully it fails.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(expectedExitCode: ErrorCodes.ERROR_INSTALL_USEREXIT);

            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB));

            this.CleanTestArtifacts = true;
        }
示例#8
0
        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.True(MsiVerifier.IsPackageInstalled(packageA));

            // Install the addon bundle, and ensure it is installed.
            BundleInstaller installerD = new BundleInstaller(this, bundleD).Install(arguments: "-parent Foo");

            Assert.True(MsiVerifier.IsPackageInstalled(packageD));

            // Uninstall the base bundle and ensure it is removed but addon is still present.
            installerA.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageD));

            // Uninstall addon bundle with the parent and ensure everything is removed.
            installerD.Uninstall(arguments: "-parent Foo");
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageD));

            this.Complete();
        }
示例#9
0
        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();
        }
示例#10
0
        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();
        }
示例#11
0
        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();
        }
示例#12
0
        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();
        }
示例#13
0
        public void Burn_UpdateInstalledBundle()
        {
            // 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();

            // Test that v1 was correctly installed.
            Assert.True(MsiVerifier.IsPackageInstalled(packageA1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageA2));

            // Run the v1 bundle providing an update bundle.
            installerA1.Modify(arguments: String.Concat("\"", "-updatebundle:", bundleA2, "\""));

            // Test that only v2 packages is installed.
            Assert.False(MsiVerifier.IsPackageInstalled(packageA1));
            Assert.True(MsiVerifier.IsPackageInstalled(packageA2));

            // Attempt to uninstall v2.
            BundleInstaller installerA2 = new BundleInstaller(this, bundleA2).Uninstall();

            // Test all packages are uninstalled.
            Assert.False(MsiVerifier.IsPackageInstalled(packageA1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageA2));
            Assert.Null(this.GetTestRegistryRoot());

            this.Complete();
        }
示例#14
0
        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();
        }
示例#15
0
        public void Burn_SlipstreamFailureRollback()
        {
            // Create a folder with same name as the file to be installed in package B, this will trigger error in B and rollback A
            string errorTriggeringFolder = this.GetTestInstallFolder(@"B\B.wxs");

            if (!Directory.Exists(errorTriggeringFolder))
            {
                Directory.CreateDirectory(errorTriggeringFolder);
            }

            // Create bundle and install everything.
            string          bundleB = this.GetBundleB().Output;
            BundleInstaller install = new BundleInstaller(this, bundleB).Install((int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_FAILURE);

            // Nothing should exist after the rollback
            string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs");

            Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Should NOT have found Package A payload installed at: ", packageSourceCodeInstalled));

            packageSourceCodeInstalled = this.GetTestInstallFolder(@"B\B.wxs");
            Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Should NOT have found Package B payload installed at: ", packageSourceCodeInstalled));
            Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should NOT exist after rollback.");

            // Delete the directory
            Directory.Delete(errorTriggeringFolder);

            this.Complete();
        }
示例#16
0
        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();
        }
示例#17
0
        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();
            }
        }
示例#18
0
        public void Burn_ParentMajorUpgrade()
        {
            // Build.
            string packageA   = this.GetPackageA().Output;
            string packageAv2 = this.GetPackageAv2().Output;
            string bundleA    = this.GetBundleA().Output;
            string bundleAv2  = this.GetBundleAv2().Output;

            // Install the bundle with a parent, and ensure it is installed.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(arguments: "-parent Foo");

            Assert.True(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            // Upgrade without a parent reference.
            BundleInstaller installerAv2 = new BundleInstaller(this, bundleAv2).Install();

            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            // Attempt to uninstall v2 bundle and ensure it is was removed.
            installerAv2.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            this.Complete();
        }
示例#19
0
        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();
        }
示例#20
0
        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;
        }
示例#21
0
        public void Burn_UpdateInstalledPerUserBundleUpdateServerNoFeed()
        {
            // Build the packages.
            string packageB1 = this.GetPackageB().Output;

            // Build the bundles.
            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();

            Directory.CreateDirectory(rootDirectory);
            this.TestArtifacts.Add(new DirectoryInfo(rootDirectory));
            RootPathProvider.RootPath = rootDirectory;

            FeedModule.FeedBehavior = FeedModule.UpdateFeedBehavior.None;
            // Verify bundle asking for update and getting a 404 doesn't update and doesn't modify state
            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));

            installerB1.Uninstall();

            // Test all packages are uninstalled.
            Assert.False(MsiVerifier.IsPackageInstalled(packageB1));
            Assert.Null(this.GetTestRegistryRoot());

            this.Complete();
        }
示例#22
0
        public void Burn_MajorUpgradeRemovesPackageFixedByRepair()
        {
            string v2Version = "2.0.0.0";
            var    pv2       = new Dictionary <string, string>()
            {
                { "Version", v2Version }
            };

            // Build the packages.
            string packageAv1 = this.GetPackageA().Output;
            string packageAv2 = this.CreatePackage("A", preprocessorVariables: pv2).Output;
            string packageB   = this.CreatePackage("B").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 }, { "packageB", packageB }
            };

            // Build the bundles.
            string bundleAv1 = this.CreateBundle("BundleA", bindPathsv1).Output;
            string bundleB   = this.CreateBundle("BundleB", bindPathsv2).Output;

            // Initialize with first bundle.
            BundleInstaller installerA = new BundleInstaller(this, bundleAv1).Install();

            Assert.True(MsiVerifier.IsPackageInstalled(packageAv1));

            // Install second bundle which will major upgrade away v1.
            BundleInstaller installerB = new BundleInstaller(this, bundleB).Install();

            Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            // Uninstall second bundle which will remove all packages
            installerB.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            // Repair first bundle to get v1 back on the machine.
            installerA.Repair();
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            // Uninstall first bundle and everything should be gone.
            installerA.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            this.Complete();
        }
示例#23
0
        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;
        }
示例#24
0
        public void Burn_InstallBundles()
        {
            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 are installed.
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB));
            using (RegistryKey root = this.GetTestRegistryRoot())
            {
                string actualVersion = root.GetValue("A") as string;
                Assert.AreEqual(expectedVersion, actualVersion);
            }

            // Uninstall in reverse order.
            installerB.Uninstall();
            installerA.Uninstall();

            // Make sure the MSIs are not installed.
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsNull(this.GetTestRegistryRoot());

            this.CleanTestArtifacts = true;
        }
        public void Burn_ForwardCompatibleMajorUpgrade()
        {
            string providerId   = String.Concat("~", this.TestContext.TestName, "_BundleA");
            string parent       = "~BundleAv1";
            string parentSwitch = String.Concat("-parent ", parent);

            // Build.
            string packageA   = this.GetPackageA().Output;
            string packageAv2 = this.GetPackageAv2().Output;

            string bundleA   = this.GetBundleA().Output;
            string bundleAv2 = this.GetBundleAv2().Output;

            // Install the v1 bundle with a parent.
            BundleInstaller installerAv1 = new BundleInstaller(this, bundleA).Install(arguments: parentSwitch);

            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageAv2));

            string actualProviderVersion;

            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 installerAv2 = new BundleInstaller(this, bundleAv2).Install();

            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageAv2));

            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.
            installerAv2.Uninstall();
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.AreEqual(V2, actualProviderVersion);
            Assert.IsTrue(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v1 bundle with passthrough and all should be removed.
            installerAv1.Uninstall(arguments: parentSwitch);
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA));
            Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));

            this.CleanTestArtifacts = true;
        }
示例#26
0
        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();
        }
示例#27
0
        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;
        }
示例#28
0
        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);
            }
        }
示例#29
0
        public void Burn_SlipstreamInstallReferenceCountUninstall()
        {
            const string patchedVersion = V101;

            // Build the bundles.
            string bundleA      = this.GetBundleA().Output;
            string bundlePatchA = this.GetBundleOnlyPatchA().Output;

            // Install the bundle with slipstreamed patch.
            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);
            }

            // Install the bundle with only the patch. This is basically a no-op.
            BundleInstaller installPatch = new BundleInstaller(this, bundlePatchA).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);
            }

            // Uninstall the bundle with only the patch. This should also basically be a no-op.
            installPatch.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(patchedVersion, actualVersion);
            }

            // Finally uninstall the original bundle and that should clean everything off.
            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_FeatureRepair()
        {
            // 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;

            // Install the bundle with the optional feature present
            this.SetPackageFeatureState("PackageA", "Test", FeatureState.Local);
            BundleInstaller install = new BundleInstaller(this, bundleA).Install();

            this.ResetPackageStates("PackageA");

            string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs");
            string packageNotKeyPathFile      = this.GetTestInstallFolder(@"A\notkeypath.file");

            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A non-keyfile installed at: ", packageSourceCodeInstalled));

            // Delete the non-keypath source file.
            File.Delete(packageNotKeyPathFile);

            // Now repair without repairing the feature to verify the non-keyfile doesn't come back.
            install.Repair();
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.False(File.Exists(packageNotKeyPathFile), String.Concat("Should have not found Package A non-keyfile installed at: ", packageNotKeyPathFile));

            // Now repair and include the feature this time.
            this.SetPackageFeatureState("PackageA", "Test", FeatureState.Local);
            install.Repair();
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.True(File.Exists(packageNotKeyPathFile), String.Concat("Should have repaired Package A non-keyfile installed at: ", packageNotKeyPathFile));
            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_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_ForwardCompatibleInstallV1UninstallV2()
        {
            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.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            string actualProviderVersion;

            Assert.True(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.Equal(V2, actualProviderVersion);

            // Install the v1 bundle with a parent which should passthrough to v2.
            BundleInstaller installerAv1 = new BundleInstaller(this, bundleA).Install(arguments: parentSwitch);

            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.True(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v2 bundle.
            installerAv2.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.True(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v1 bundle with passthrough and all should be removed.
            installerAv1.Uninstall(arguments: parentSwitch);
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.False(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));


            this.Complete();
        }
示例#33
0
        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();
        }
示例#34
0
        public void Burn_RetryThenCancel()
        {
            this.SetPackageRetryExecuteFilesInUse("PackageA", 1);

            string bundleAPath = this.GetBundleA().Output;
            BundleInstaller installA = new BundleInstaller(this, bundleAPath);

            // Lock the file that will be installed.
            string targetInstallFile = this.GetTestInstallFolder("A\\A.wxs");
            Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile));
            using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                installA.Install(expectedExitCode:(int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
            }

            this.Complete();
        }
        public void Burn_PermanentInstallUninstallForceUninstall()
        {
            // 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 Bundle A.
            installerA.Uninstall();

            Assert.True(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageB));

            // Force Uninstall Bundle A.
            this.SetPackageRequestedState("PackageA", WixToolset.Bootstrapper.RequestState.ForceAbsent);
            this.SetPackageRequestedState("PackageB", WixToolset.Bootstrapper.RequestState.ForceAbsent);
            installerA.Uninstall();

            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageB));

            this.Complete();
        }
示例#36
0
        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_InstallUninstall()
        {
            // 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;

            // Create the named bind paths to the packages.
            Dictionary <string, string> bindPaths = new Dictionary <string, string>();

            bindPaths.Add("packageA", Path.GetDirectoryName(packageA));
            bindPaths.Add("packageB", Path.GetDirectoryName(packageB));
            bindPaths.Add("packageC", Path.GetDirectoryName(packageC));

            string bundleA = new BundleBuilder(this, "BundleA")
            {
                BindPaths = bindPaths, Extensions = Extensions
            }.Build().Output;

            string packageASourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs");
            string packageBSourceCodeInstalled = this.GetTestInstallFolder(@"B\B.wxs");
            string packageCSourceCodeInstalled = this.GetTestInstallFolder(@"C\C.wxs");

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should not be there on test start: ", packageASourceCodeInstalled));
            Assert.False(File.Exists(packageBSourceCodeInstalled), String.Concat("Package B payload should not be there on test start: ", packageBSourceCodeInstalled));
            Assert.False(File.Exists(packageCSourceCodeInstalled), String.Concat("Package C payload should not be there on test start: ", packageCSourceCodeInstalled));

            BundleInstaller install = new BundleInstaller(this, bundleA).Install();

            // Source file should be installed
            Assert.True(File.Exists(packageASourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageASourceCodeInstalled));
            Assert.True(File.Exists(packageBSourceCodeInstalled), String.Concat("Should have found Package B payload installed at: ", packageBSourceCodeInstalled));
            Assert.True(File.Exists(packageCSourceCodeInstalled), String.Concat("Should have found Package C payload installed at: ", packageCSourceCodeInstalled));


            // Uninstall everything.
            install.Uninstall();

            // Source file should *not* be installed
            Assert.False(File.Exists(packageASourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageASourceCodeInstalled));
            Assert.False(File.Exists(packageBSourceCodeInstalled), String.Concat("Package B payload should have been removed by uninstall from: ", packageBSourceCodeInstalled));
            Assert.False(File.Exists(packageCSourceCodeInstalled), String.Concat("Package C payload should have been removed by uninstall from: ", packageCSourceCodeInstalled));

            this.Complete();
        }
示例#38
0
        public void Burn_InstallUninstallAddonRelatedBundle()
        {
            // Build the packages.
            string packageA = new PackageBuilder(this, "A").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("packageC", packageC);
            bindPaths.Add("packageD", packageD);

            // 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;

            // Install the bundles.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();
            BundleInstaller installerC = new BundleInstaller(this, bundleC).Install();

            // Test that packages A and C but not D are installed.
            Assert.True(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageC));
            Assert.False(MsiVerifier.IsPackageInstalled(packageD));

            // Attempt to uninstall bundleA.
            installerA.Uninstall();

            // Test that uninstalling bundle A detected and would remove bundle C.
            Assert.True(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.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageC));
            Assert.False(MsiVerifier.IsPackageInstalled(packageD));

            this.Complete();
        }
示例#39
0
        public void Burn_RetryThenCancel()
        {
            this.SetPackageRetryExecuteFilesInUse("PackageA", 1);

            string          bundleAPath = this.GetBundleA().Output;
            BundleInstaller installA    = new BundleInstaller(this, bundleAPath);

            // Lock the file that will be installed.
            string targetInstallFile = this.GetTestInstallFolder("A\\A.wxs");

            Directory.CreateDirectory(Path.GetDirectoryName(targetInstallFile));
            using (FileStream lockTargetFile = new FileStream(targetInstallFile, FileMode.Create, FileAccess.Write, FileShare.Read))
            {
                installA.Install(expectedExitCode: (int)MSIExec.MSIExecReturnCode.ERROR_INSTALL_USEREXIT);
            }

            this.Complete();
        }
示例#40
0
        public void Burn_MimimalAdditionalRegistration()
        {
            // Build the bundle.
            string bundleA = new BundleBuilder(this, "BundleA") { Extensions = Extensions, AdditionalSourceFiles = this.AdditionalSourceFiles }.Build().Output;

            // Install the bundle.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install();

            // Make sure the registry exists.
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft Corporation\Updates\~Burn_MimimalAdditionalRegistration - Bundle A"))
            {
                Assert.Equal("Y", key.GetValue("ThisVersionInstalled"));
                Assert.Equal("Microsoft Corporation", key.GetValue("Publisher"));
                Assert.Equal("Update", key.GetValue("ReleaseType"));
            }

            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_ForwardCompatibleMajorUpgradeParentNone()
        {
            string providerId   = String.Concat("~", this.TestContext.TestName, "_BundleA");
            string parent       = "~BundleAv1";
            string parentSwitch = String.Concat("-parent ", parent);

            // Build.
            string packageA   = this.GetPackageA().Output;
            string packageAv2 = this.GetPackageAv2().Output;

            string bundleA   = this.GetBundleA().Output;
            string bundleAv2 = this.GetBundleAv2().Output;

            // Install the v1 bundle with a parent.
            BundleInstaller installerAv1 = new BundleInstaller(this, bundleA).Install(arguments: parentSwitch);

            Assert.True(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            string actualProviderVersion;

            Assert.True(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.Equal("1.0.0.0", actualProviderVersion);
            Assert.True(this.DependencyDependentExists(providerId, parent));

            // Upgrade with the v2 bundle but prevent self parent being registered.
            BundleInstaller installerAv2 = new BundleInstaller(this, bundleAv2).Install(arguments: "-parent:none");

            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.True(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.True(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
            Assert.Equal(V2, actualProviderVersion);
            Assert.True(this.DependencyDependentExists(providerId, parent));

            // Uninstall the v1 bundle with passthrough and all should be removed.
            installerAv1.Uninstall(arguments: parentSwitch);
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            Assert.False(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));

            this.Complete();
        }
示例#43
0
        public void Burn_FeatureRepair()
        {
            // 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;

            // Install the bundle with the optional feature present
            this.SetPackageFeatureState("PackageA", "Test", FeatureState.Local);
            BundleInstaller install = new BundleInstaller(this, bundleA).Install();
            this.ResetPackageStates("PackageA");

            string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs");
            string packageNotKeyPathFile = this.GetTestInstallFolder(@"A\notkeypath.file");

            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A non-keyfile installed at: ", packageSourceCodeInstalled));

            // Delete the non-keypath source file.
            File.Delete(packageNotKeyPathFile);

            // Now repair without repairing the feature to verify the non-keyfile doesn't come back.
            install.Repair();
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.False(File.Exists(packageNotKeyPathFile), String.Concat("Should have not found Package A non-keyfile installed at: ", packageNotKeyPathFile));

            // Now repair and include the feature this time.
            this.SetPackageFeatureState("PackageA", "Test", FeatureState.Local);
            install.Repair();
            Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A keyfile installed at: ", packageSourceCodeInstalled));
            Assert.True(File.Exists(packageNotKeyPathFile), String.Concat("Should have repaired Package A non-keyfile installed at: ", packageNotKeyPathFile));
            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();
        }
示例#44
0
        public void Burn_MajorUpgrade()
        {
            string v2Version = "2.0.0.0";
            Dictionary <string, string> pv = new Dictionary <string, string>()
            {
                { "Version", v2Version }
            };

            // Build the packages.
            string packageAv1 = this.GetPackageA().Output;
            string packageAv2 = this.CreatePackage("A", preprocessorVariables: pv).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 = this.CreateBundle("BundleA", bindPathsv1).Output;
            string bundleAv2 = this.CreateBundle("BundleA", bindPathsv2, preprocessorVariables: pv).Output;

            // Initialize with first bundle.
            BundleInstaller installerAv1 = new BundleInstaller(this, bundleAv1).Install();

            Assert.True(MsiVerifier.IsPackageInstalled(packageAv1));

            // 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));

            // Uninstall the second bundle and everything should be gone.
            installerAv2.Uninstall();
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv1));
            Assert.False(MsiVerifier.IsPackageInstalled(packageAv2));

            this.Complete();
        }
示例#45
0
        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.Complete();
        }
示例#46
0
        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();
        }
示例#47
0
        public void Burn_MaximumAdditionalRegistration()
        {
            // Build the bundle.
            string bundleC = new BundleBuilder(this, "BundleC") { Extensions = Extensions, AdditionalSourceFiles = this.AdditionalSourceFiles }.Build().Output;

            // Install the bundle.
            BundleInstaller installerC = new BundleInstaller(this, bundleC).Install();

            // Make sure the registry exists.
            using (RegistryKey key = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Updates\Visual Studio 11\KB1234567"))
            {
                Assert.Equal("Y", key.GetValue("ThisVersionInstalled"));
                Assert.Equal("Microsoft Corporation", key.GetValue("Publisher"));
                Assert.Equal("Developer Division", key.GetValue("PublishingGroup"));
                Assert.Equal("Service Pack", key.GetValue("ReleaseType"));
            }

            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();
        }
示例#49
0
        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;
        }
示例#50
0
        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();
        }
示例#51
0
        public void Burn_CancelVeryEarly()
        {
            // 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 bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;

            // Cancel package B right away.
            this.SetPackageCancelExecuteAtProgress("PackageB", 1);

            // Install the bundle and hopefully it fails.
            BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(expectedExitCode: ErrorCodes.ERROR_INSTALL_USEREXIT);
            Assert.False(MsiVerifier.IsPackageInstalled(packageA));
            Assert.False(MsiVerifier.IsPackageInstalled(packageB));

            this.Complete();
        }
示例#52
0
        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();
        }
示例#53
0
        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;
        }
示例#54
0
        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;
        }
示例#55
0
        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;
        }
示例#56
0
        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;
        }
示例#57
0
        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;
        }
示例#58
0
        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;
        }
示例#59
0
        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;
        }
示例#60
0
        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;
        }