我制作了一个封装 2 msi (msi1 , msi2) 的烧录包。在 UI 中,我使用复选框来要求用户选择要安装的 MSI。
现在,如果用户选择要安装的 msi 之一,安装会正常进行。但在卸载操作期间,刻录日志文件显示:
[][:15]: Detected package: Netfx4Full, state: Present, cached: None
[][:15]: Detected package: DummyInstallationPackageId3, state: **Absent**, cached: None
[][:15]: Detected package: msi2.msi, state: **Present**, cached: Complete
[][:15]: Detect complete, result: 0x0
[][:16]: Plan 3 packages, action: Uninstall
[][:16]: Will not uninstall package: msi2.msi, found dependents: 1
[][:16]: Found dependent: {08e74372-83f2-4594-833b-e924b418b360}, name: My Test Application
在安装场景中,我选择安装 msi2 而不是 msi1。
我的捆绑代码如下所示:
<Bundle Name="My Test Application" Version="1.0.0.0" Manufacturer="Bryan" UpgradeCode="CC2A383C-751A-43B8-90BF-A250F7BC2863">
<Chain>
<PackageGroupRef Id='Netfx4Full' />
<MsiPackage Id="DummyInstallationPackageId3"
SourceFile="msi1.msi"
ForcePerMachine="yes"
InstallCondition="var1 = 1"
>
</MsiPackage>
<MsiPackage
SourceFile="msi2.msi"
Vital="yes" Cache="yes" Visible="no"
ForcePerMachine="yes"
InstallCondition="var2 = 2"
>
</MsiPackage>
</Chain>
我的 OnDetectPackageComplete() 看起来像:
private void OnDetectPackageComplete(object sender, DetectPackageCompleteEventArgs e)
{
if (e.PackageId == "DummyInstallationPackageId3" )
{
if (e.State == PackageState.Absent)
InstallEnabled = true;
else if (e.State == PackageState.Present)
UninstallEnabled = true;
}
}
我应该怎么做才能让刻录包能够自由卸载用户在安装时选择的 msi。此外,如果我同时选择安装 msi,则卸载工作正常。
IMO,捆绑和2 msi的关系存在一些问题。请帮助我,因为我遇到了这个问题。