@Nagy维尔莫什,您的解决方案将不会在64位操作系统上运行。刻录是32位程序。它将启动32位“dism.exe”,即使您希望它通过在64位操作系统上提供完整路径“C:\ Windows \ System32 \ dism.exe”来运行64位dism.exe。这是由“File System Redirector”造成的。
该dism的日志会告诉你它是32位或64位。打开文件 “C:\ WINDOWS \日志\ DISM \ dism.log”,你会发现这样的信息:
Host machine information: OS Version=6.1.7600, Running architecture=x86
或者,
Host machine information: OS Version=6.1.7600, Running architecture=amd64
当您尝试DISM上运行32位和64位操作系统,您将收到此错误
Error: 11 You cannot service a running 64-bit operating system with a 32-bit version of DI SM. Please use the version of DISM that corresponds to your computer's architecture. The DISM log file can be found at C:\Windows\Logs\DISM\dism.log
我的解决方案是创建另一个WiX的安装项目“InstallPrerequisites”,并以“QtExec64CmdLine”运行64位DISM。以下是一个示例:
<!--1.You need to use the x64 version of quiet command line
2.[System64Folder] is also needed. If not, QtExec64CmdLine will find a 32-bit dism.exe to run.
-->
<Property Id="QtExec64CmdLine" Value='"[System64Folder]dism.exe" /Online /Apply-Unattend:[ProductTmpFolder]iis_unattend.xml'/>
<CustomAction Id="SilentLaunch" BinaryKey="WixCA" DllEntry="CAQuietExec64" Execute="immediate" Return="check" />
我使用答案文件来包含所有功能,因此我们可以一次启用它们。然后链安装
<MsiPackage DisplayName="Install Prerequisites" SourceFile="$(var.InstallPrerequisites.TargetPath)" />
更新: 通过使用 “C:\ WINDOWS \ SysNative \ dism.exe”,我现在可以避免x64平台的独立项目。从日志中可以看到,32位进程现在正在运行64位DISM。
2015-10-26 16:28:07, Info DISM DISM.EXE: <----- Starting Dism.exe session ----->
2015-10-26 16:28:07, Info DISM DISM.EXE:
2015-10-26 16:28:07, Info DISM DISM.EXE: Host machine information: OS Version=6.1.7601, Running architecture=amd64, Number of processors=4
2015-10-26 16:28:07, Info DISM DISM.EXE: Executing command line: C:\windows\SysNative\dism.exe
2015-10-26 16:28:07, Info DISM DISM Provider Store: PID=2000 Getting the collection of providers from a local provider store type. - CDISMProviderStore::GetProviderCollection
....
2015-10-26 16:28:09, Info DISM DISM.EXE: Image session has been closed. Reboot required=no.
2015-10-26 16:28:09, Info DISM DISM.EXE:
2015-10-26 16:28:09, Info DISM DISM.EXE: <----- Ending Dism.exe session ----->
要使它在64位操作系统上工作,只需将DISM作为解释[这里](http://stackoverflow.com/a/5936741/15186)以避免重定向。 –
@omatrot它的工作原理,我已经更新了答案。谢谢! – Rader