本文整理汇总了C#中BundleInstaller.Uninstall方法的典型用法代码示例。如果您正苦于以下问题:C# BundleInstaller.Uninstall方法的具体用法?C# BundleInstaller.Uninstall怎么用?C# BundleInstaller.Uninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BundleInstaller
的用法示例。
在下文中一共展示了BundleInstaller.Uninstall方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Burn_InstallUpdatedBundle
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();
}
示例2: Burn_PermanentInstallForceUninstall
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();
}
示例3: Burn_PermanentInstallUninstall
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();
}
示例4: Burn_InstallUninstall
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();
}
示例5: Burn_ComponentSearchResults
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();
}
示例6: Burn_ParentInstallAddonUninstall
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;
}
示例7: Burn_RedirectPackageCache
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();
}
}
示例8: Burn_InstallUninstallBundleWithEmbeddedBundle
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();
}
示例9: Burn_InstallUninstallAddonPatchRelatedBundle
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;
}
示例10: Burn_InstallLockUninstallInstallUninstall
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();
}
示例11: Burn_PatchInstallUninstall
public void Burn_PatchInstallUninstall()
{
string originalVersion = "1.0.0.0";
string patchedVersion = "1.0.1.0";
// Build the packages.
string packageA = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions }.Build().Output;
string packageAUpdate = new PackageBuilder(this, "A") { Extensions = WixTests.Extensions, PreprocessorVariables = new Dictionary<string, string>() { { "Version", patchedVersion } }, NeverGetsInstalled = true }.Build().Output;
string patchA = new PatchBuilder(this, "PatchA") { Extensions = WixTests.Extensions, TargetPath = packageA, UpgradePath = packageAUpdate }.Build().Output;
// Create the named bind paths to the packages.
Dictionary<string, string> bindPaths = new Dictionary<string, string>();
bindPaths.Add("packageA", packageA);
bindPaths.Add("patchA", patchA);
string bundleA = new BundleBuilder(this, "BundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
string bundleAPatch = new BundleBuilder(this, "PatchBundleA") { BindPaths = bindPaths, Extensions = Extensions }.Build().Output;
// Install the unpatched bundle.
BundleInstaller installA = new BundleInstaller(this, bundleA).Install();
using (RegistryKey root = this.GetTestRegistryRoot())
{
string actualVersion = root.GetValue("A") as string;
Assert.AreEqual(originalVersion, actualVersion);
}
// Install the patch bundle.
BundleInstaller installAPatch = new BundleInstaller(this, bundleAPatch).Install();
using (RegistryKey root = this.GetTestRegistryRoot())
{
string actualVersion = root.GetValue("A") as string;
Assert.AreEqual(patchedVersion, actualVersion);
}
// Uninstall the patch bundle.
installAPatch.Uninstall();
using (RegistryKey root = this.GetTestRegistryRoot())
{
string actualVersion = root.GetValue("A") as string;
Assert.AreEqual(originalVersion, actualVersion);
}
installA.Uninstall();
Assert.IsNull(this.GetTestRegistryRoot(), "Test registry key should have been removed during uninstall.");
this.CleanTestArtifacts = true;
}
示例12: Burn_AutomaticSlipstreamInstallUninstall
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();
}
示例13: Burn_ForwardCompatibleInstallV1UninstallV1
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;
}
示例14: Burn_FeatureInstallUninstall
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();
}
示例15: Burn_ParentInstallTwiceThenUninstall
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();
}