public void Burn_InstallPatchBundle() { const string expectedVersion = "1.0.1.0"; // Build the packages. string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA2 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion } }, NeverGetsInstalled = true }.Build().Output; string packageB = new PackageBuilder(this, "B") { Extensions = Extensions }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion } }, TargetPath = packageA1, UpgradePath = packageA2 }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA1); bindPaths.Add("packageB", packageB); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleF = new BundleBuilder(this, "BundleF") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleG = new BundleBuilder(this, "BundleG") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the base bundle and make sure all packages are installed. BundleInstaller installerF = new BundleInstaller(this, bundleF).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); // Install patch bundle and make sure all packages are installed. BundleInstaller installerG = new BundleInstaller(this, bundleG).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // Uninstall the base bundle and make sure all packages are uninstalled. installerF.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA1)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageB)); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); this.CleanTestArtifacts = true; }
public void Burn_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; }