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_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(); }
public void Burn_FailNonVitalPackage() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageC); // Build the bundle. string bundleE = new BundleBuilder(this, "BundleE") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundle and make sure packageA is installed. // SFBUG:3435047 - Make sure during install we don't fail for non-vital packages. BundleInstaller installerE = new BundleInstaller(this, bundleE).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the bundle. // SFBUG:3435047 - Make sure during repair we don't fail for the same reason in a different code path. installerE.Repair(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Uninstall the bundle and make sure packageA is uninstalled. installerE.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_SlipstreamReverseRepair() { const string patchedVersion = V101; string bundleA = this.GetBundleAReverse().Output; // Ensure the patch is not installed when the bundle installs. BundleInstaller install = new BundleInstaller(this, bundleA).Install(); string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.True(patchedVersion == actualVersion, "Patch A should not have been installed."); } // Repair the bundle and send the patch along for the ride. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } install.Repair(); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload *still* installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.True(patchedVersion.Equals(actualVersion), "Patch A should have been installed during the repair."); } install.Uninstall(); // uninstall just to make sure no error occur removing the package without the patch. Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_SlipstreamRepair() { const string patchedVersion = V101; string bundleA = this.GetBundleA().Output; BundleInstaller install = new BundleInstaller(this, bundleA).Install(); string packageSourceCodeInstalled = this.GetTestInstallFolder(@"A\A.wxs"); Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload installed at: ", packageSourceCodeInstalled)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } // Delete the installed file and registry key. File.Delete(packageSourceCodeInstalled); using (RegistryKey root = this.GetTestRegistryRoot()) { root.DeleteValue("A"); } // Repair and verify the repair fixed everything. install.Repair(); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("A") as string; Assert.Equal(patchedVersion, actualVersion); } Assert.True(File.Exists(packageSourceCodeInstalled), String.Concat("Should have found Package A payload repaired at: ", packageSourceCodeInstalled)); // Clean up. install.Uninstall(); Assert.False(File.Exists(packageSourceCodeInstalled), String.Concat("Package A payload should have been removed by uninstall from: ", packageSourceCodeInstalled)); Assert.True(null == this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall."); this.Complete(); }
public void Burn_InstallUpgradeSlipstreamBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } }, TargetPath = packageA, UpgradePath = packageA1 }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Install the upgrade bundle with a slipstreamed patch and make sure the patch is installed. // SFBUG:3387046 - Uninstalling bundle registers a dependency on a package BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // BundleC doesn't carry the EXE, so make sure it's removed. using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the upgrade bundle to make sure it does not prompt for source. // SFBUG:3386927 - MSIs get removed from cache during upgrade installerC.Repair(); // Uninstall the slipstream bundle and make sure both packages are uninstalled. installerC.Uninstall(); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); this.CleanTestArtifacts = true; }
public void Burn_FailNonVitalPackage() { // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageC = new PackageBuilder(this, "C") { Extensions = Extensions }.Build().Output; // Create the named bind paths to the packages. Dictionary<string, string> bindPaths = new Dictionary<string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("packageB", packageC); // Build the bundle. string bundleE = new BundleBuilder(this, "BundleE") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; // Install the bundle and make sure packageA is installed. // SFBUG:3435047 - Make sure during install we don't fail for non-vital packages. BundleInstaller installerE = new BundleInstaller(this, bundleE).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the bundle. // SFBUG:3435047 - Make sure during repair we don't fail for the same reason in a different code path. installerE.Repair(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC)); using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Uninstall the bundle and make sure packageA is uninstalled. installerE.Uninstall(); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); Assert.IsNull(this.GetTestRegistryRoot()); this.CleanTestArtifacts = true; }
public void Burn_InstallUpgradeSlipstreamBundle() { const string expectedVersion1 = "1.0.0.0"; const string expectedVersion2 = "1.0.1.0"; // Build the packages. string packageA = new PackageBuilder(this, "A") { Extensions = Extensions }.Build().Output; string packageA1 = new PackageBuilder(this, "A") { Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } }, NeverGetsInstalled = true }.Build().Output; string patchA = new PatchBuilder(this, "PatchA") { PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } }, TargetPath = packageA, UpgradePath = packageA1 }.Build().Output; // Create the named bind paths to the packages. Dictionary <string, string> bindPaths = new Dictionary <string, string>(); bindPaths.Add("packageA", packageA); bindPaths.Add("patchA", patchA); // Build the bundles. string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output; string bundleC = new BundleBuilder(this, "BundleC") { BindPaths = bindPaths, Extensions = Extensions, PreprocessorVariables = new Dictionary <string, string>() { { "Version", expectedVersion2 } } }.Build().Output; // Install the base bundle and make sure it's installed. BundleInstaller installerA = new BundleInstaller(this, bundleA).Install(); Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageA)); using (RegistryKey root = this.GetTestRegistryRoot()) { string actualVersion = root.GetValue("Version") as string; Assert.AreEqual(expectedVersion1, actualVersion); } // Install the upgrade bundle with a slipstreamed patch and make sure the patch is installed. // SFBUG:3387046 - Uninstalling bundle registers a dependency on a package BundleInstaller installerC = new BundleInstaller(this, bundleC).Install(); Assert.IsTrue(MsiUtils.IsPatchInstalled(patchA)); // BundleC doesn't carry the EXE, so make sure it's removed. using (RegistryKey root = this.GetTestRegistryRoot()) { Assert.IsNull(root.GetValue("Version")); } // Repair the upgrade bundle to make sure it does not prompt for source. // SFBUG:3386927 - MSIs get removed from cache during upgrade installerC.Repair(); // Uninstall the slipstream bundle and make sure both packages are uninstalled. installerC.Uninstall(); Assert.IsFalse(MsiUtils.IsPatchInstalled(patchA)); Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageA)); this.CleanTestArtifacts = true; }
public void Burn_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.Completed(); }
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(); }