本文整理汇总了C#中BundleInstaller.Install方法的典型用法代码示例。如果您正苦于以下问题:C# BundleInstaller.Install方法的具体用法?C# BundleInstaller.Install怎么用?C# BundleInstaller.Install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BundleInstaller
的用法示例。
在下文中一共展示了BundleInstaller.Install方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Burn_RetryThenCancel
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();
}
示例2: Burn_ForwardCompatiblePerUserParentTwiceMajorUpgrade
public void Burn_ForwardCompatiblePerUserParentTwiceMajorUpgrade()
{
string providerId = String.Concat("~", this.TestContext.TestName, "_BundleC");
string parent = "~BundleCv1";
string parent2 = "~BundleCv1_Parent2";
string parentSwitch = String.Concat("-parent ", parent);
string parent2Switch = String.Concat("-parent ", parent2);
// Build.
string packageC = this.GetPackageC().Output;
string packageCv2 = this.GetPackageCv2().Output;
string bundleC = this.GetBundleC().Output;
string bundleCv2 = this.GetBundleCv2().Output;
// Install the v1 bundle with a parent.
BundleInstaller installerCv1 = new BundleInstaller(this, bundleC).Install(arguments: parentSwitch);
Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));
string actualProviderVersion;
Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
Assert.AreEqual("1.0.0.0", actualProviderVersion);
Assert.IsTrue(this.DependencyDependentExists(providerId, parent));
// Install the v1 bundle with a second parent.
installerCv1.Install(arguments: parent2Switch);
Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));
Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
Assert.AreEqual("1.0.0.0", actualProviderVersion);
Assert.IsTrue(this.DependencyDependentExists(providerId, parent));
// Upgrade with the v2 bundle.
BundleInstaller installerCv2 = new BundleInstaller(this, bundleCv2).Install();
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));
Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
Assert.AreEqual(V2, actualProviderVersion);
Assert.IsTrue(this.DependencyDependentExists(providerId, parent));
// Uninstall the v2 bundle and nothing should happen because there is still a parent.
installerCv2.Uninstall();
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));
Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
Assert.AreEqual(V2, actualProviderVersion);
Assert.IsTrue(this.DependencyDependentExists(providerId, parent));
// Uninstall one parent of the v1 bundle and nothing should happen because there is still a parent.
installerCv1.Uninstall(arguments: parentSwitch);
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsTrue(MsiVerifier.IsPackageInstalled(packageCv2));
Assert.IsTrue(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
Assert.AreEqual(V2, actualProviderVersion);
Assert.IsTrue(this.DependencyDependentExists(providerId, parent2));
// Uninstall the v1 bundle with passthrough with second parent and all should be removed.
installerCv1.Uninstall(arguments: parent2Switch);
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageC));
Assert.IsFalse(MsiVerifier.IsPackageInstalled(packageCv2));
Assert.IsFalse(this.TryGetDependencyProviderValue(providerId, "Version", out actualProviderVersion));
this.CleanTestArtifacts = true;
}