我目前有一个场景,我需要使用刻录
执行以下操作我想知道安装MsuPackage后是否有办法强制重启......
在我的方案中,当引导程序在Windows Vista上安装Windows6.0-KB942288-v2-x86.msu并随后尝试安装.Net Framework而不重新启动时会抛出错误:0x8007064d - 此安装包无法通过Windows安装程序服务......
如果我在错误后重新启动并再次运行安装程序,它可以正常工作。请注意,使用ExePackage可以指定InstallCommand以及ExitCode,如何在MsuPackage中实现相同的行为?
请参阅下面我的wxs文件的内容:
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
xmlns:bal="http://schemas.microsoft.com/wix/BalExtension"
xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
<Bundle Name="$(var.MyProject.ProjectName)" Version="2.6.0.0" Manufacturer="Awesome Software (Pty) Ltd" UpgradeCode="6a77118d-c132-4454-850b-935edc287945">
<BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense">
<bal:WixStandardBootstrapperApplication
LicenseFile="$(var.SolutionDir)Awesome.EULA\Awesome CE Eula.rtf"
SuppressOptionsUI="yes"/>
</BootstrapperApplicationRef>
<util:FileSearch Path="[SystemFolder]\windowscodecs.dll" Variable="windowscodecs" Result="exists" />
<Chain>
<!-- Windows Imaging Component-->
<ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="redist\wic_x86_enu.exe"
DownloadUrl="http://download.microsoft.com/download/f/f/1/ff178bb1-da91-48ed-89e5-478a99387d4f/wic_x86_enu.exe"
InstallCondition="VersionNT < v5.2 AND NOT VersionNT64"
DetectCondition="windowscodecs"
InstallCommand="/quiet /norestart">
</ExePackage>
<ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="redist\wic_x64_enu.exe"
DownloadUrl="http://download.microsoft.com/download/6/4/5/645FED5F-A6E7-44D9-9D10-FE83348796B0/wic_x64_enu.exe"
InstallCondition="VersionNT < v5.2 AND VersionNT64"
DetectCondition="windowscodecs"
InstallCommand="/quiet /norestart">
</ExePackage>
<!-- Windows Installer 4.5 -->
<ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="redist\WindowsXP-KB942288-v3-x86.exe"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsXP-KB942288-v3-x86.exe"
InstallCondition="VersionNT=v5.1 AND NOT VersionNT64 AND VersionMsi < v4.5"
InstallCommand="/quiet /norestart">
<ExitCode Behavior="forceReboot"/>
</ExePackage>
<ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="redist\WindowsServer2003-KB942288-v4-x86.exe"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsServer2003-KB942288-v4-x86.exe"
InstallCondition="VersionNT=v5.2 AND NOT VersionNT64 AND VersionMsi < v4.5"
InstallCommand="/quiet /norestart">
<ExitCode Behavior="forceReboot"/>
</ExePackage>
<ExePackage Cache="no" Compressed="no" PerMachine="yes" Permanent="yes" Vital="yes"
SourceFile="redist\WindowsServer2003-KB942288-v4-x64.exe"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/WindowsServer2003-KB942288-v4-x64.exe"
InstallCondition="VersionNT=v5.2 AND VersionNT64 AND VersionMsi < v4.5"
InstallCommand="/quiet /norestart">
<ExitCode Behavior="forceReboot"/>
</ExePackage>
<MsuPackage Cache="no" Compressed="no" Permanent="yes" Vital="yes" KB="KB942288"
SourceFile="redist\Windows6.0-KB942288-v2-x86.msu"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x86.msu"
InstallCondition="VersionNT=v6.0 AND NOT VersionNT64 AND VersionMsi < v4.5">
</MsuPackage>
<MsuPackage Cache="no" Compressed="no" Permanent="yes" Vital="yes" KB="KB942288"
SourceFile="redist\Windows6.0-KB942288-v2-x64.msu"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x64.msu"
InstallCondition="VersionNT=v6.0 AND VersionNT64 AND VersionMsi < v4.5">
</MsuPackage>
<PackageGroupRef Id="NetFx40Web"/>
<RollbackBoundary />
<MsiPackage Id="MaxCut" SourceFile=".\StagingBundle\Awesome.msi" DisplayInternalUI="no"/>
</Chain>
</Bundle>
</Wix>
答案 0 :(得分:2)
自动检测到MsuPackage重启。你安装的MSU可能说它需要重启(日志文件应该说一些,IIRC)但不需要强制重启。已经要求Burn有一种方法可以将“需要重新启动”提升到“现在重新开始,如果此时需要重新启动”链中。不幸的是,此时此功能尚不存在。
但是,您可以通过从IDRESTART
回调返回OnExecutePackageComplete()
在自定义BootstrapperApplication中实现“立即强制重启”行为。在有人实现该功能之前,这是唯一的选择。
答案 1 :(得分:1)
我最近需要这样做,并且不想为每个MSU编写引导程序或创建其他引导EXE
作为一种解决方法,我添加了一个在MsuPackage
之后不执行任何操作的可执行文件(NOP.EXE),并使用ExitCode
强制重新启动。
DetectCondition
和MsuPackage
都需要使用相同的ExePackage
。
您可以在多个MsuPackages之后使用同一可执行文件
类似...
<Fragment>
<util:FileSearch Path="PathToSomeDotNetDll" Result="version" Variable="DotNetVersionCheck" />
<PackageGroup Id="net45_x86">
<MsuPackage Cache="no"
Compressed="no"
DetectCondition="DotNetVersionCheck >= v4.5"
Permanent="yes"
Vital="yes"
KB="KB942288"
SourceFile="redist\Windows6.0-KB942288-v2-x86.msu"
DownloadUrl="http://download.microsoft.com/download/2/6/1/261fca42-22c0-4f91-9451-0e0f2e08356d/Windows6.0-KB942288-v2-x86.msu"
InstallCondition="VersionNT=v6.0 AND NOT VersionNT64 AND VersionMsi < v4.5">
</MsuPackage>
<!-- Trick the bootstrapper into rebooting now by running an executable that does nothing and set ExitCode to force a reboot -->
<ExePackage SourceFile="bin\nop.exe"
DisplayName="Reboot required after KB942288"
DetectCondition="DotNetVersionCheck >= v4.5"
InstallCommand="nop.exe"
InstallCondition="VersionNT=v6.0 AND NOT VersionNT64 AND VersionMsi < v4.5"
Permanent="yes">
<ExitCode Behavior="forceReboot"/>
</ExePackage>
</PackageGroup>
</Fragment>