@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