我知道这个很旧,但既然我遇到了这个问题,也许它也会对某人有所帮助。
在我的情况下,修复就足够了,所以虽然从技术上讲它不是重新安装,但实际上修复 = 重新安装。
我需要重新安装 URLrewrite,因为禁用 IIS Windows 功能时它可能会损坏。
在自定义 BootstrapperApplication 类中为 PlanPackageBegin 添加自定义处理程序需要什么,例如:
CustomBootstrapperApplication.Model.Bootstrapper.PlanPackageBegin += this.PlanPackageBegin;
...........
private void PlanPackageBegin(object sender, PlanPackageBeginEventArgs e)
{
if (e.PackageId.ToLower().Contains("urlrewrite"))
{
if (CustomBootstrapperApplication.Model.Command.Action != LaunchAction.Uninstall && e.State == RequestState.Present)
{
CustomBootstrapperApplication.Model.Engine.Log(LogLevel.Verbose, string.Format("{0} is installed, forcing Repair", e.PackageId));
e.State = RequestState.Repair;
}
}
_packageList.Add(e.PackageId, e.State);
}
在捆绑包中:
<!-- Note: this Id is used in PlanPackageBegin -->
<MsiPackage Id='urlrewrite2X64' Vital='no'
Permanent='yes'
SourceFile="rewrite_amd64.msi"
DownloadUrl="http://example.com/rewrite_amd64.msi"
DisplayInternalUI="no"
Visible="yes"
InstallCondition="VersionNT64"/>
您可以在升级期间通过 PlanPackageBegin 中的类似内容强制卸载以前的 MSI:
if (LaunchAction.Uninstall == CustomBootstrapperApplication.Model.Command.Action && (CustomBootstrapperApplication.Model.Command.Relation == RelationType.Upgrade))
{
e.State = RequestState.None;
}