[英]Wix MSI Only Works on One Computer
我最近完成了我的第一個Wix Intaller,但是我有一個問題,我的MSI文件僅在我的計算機上有效,我正在生成嵌入式CAB文件。 我正在安裝程序中注冊DLL。 我收到錯誤消息:“此Windows Installer軟件包存在問題。作為安裝程序一部分運行的程序未按預期完成。” 這就是為什么我認為DLL是問題的一部分的原因。 我在下面提供了一些代碼段,如果您需要查看更多代碼段,請告訴我,謝謝!
DLL安裝的自定義操作:
<Product Id="*" UpgradeCode="12345678-1234-1234-1234-111111111111"
Name="FP7000 Camera App" Version="1.0" Manufacturer="Stryker Corp" Language="1033">
<Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="no"/>
<!--Installing/Uninstalling Supporting Programs and DLLs-->
<CustomAction Id="RegisterFP7000"
Directory="dirCF50D58BC65CC93005501980AACC3EDD"
ExeCommand='C:\Windows\system32\regsvr32.exe /s "C:\Projects\Stryker\Install Files\DLLs\FP7000-Camera.dll"'>
</CustomAction>
<CustomAction Id="UnregisterFP7000"
Directory="dirCF50D58BC65CC93005501980AACC3EDD"
ExeCommand='C:\Windows\system32\regsvr32.exe /s /u "C:\Projects\Stryker\Install Files\DLLs\FP7000-Camera.dll"'>
</CustomAction>
<CustomAction Id="InstallSDK"
Directory="dirCF50D58BC65CC93005501980AACC3EDD"
ExeCommand='C:\Windows\system32\msiexec /i "C:\Projects\Stryker\Install Files\Included Apps\Intel_Media_SDK_2016_R2.msi" /quiet'
Execute='deferred'
Impersonate='no'
Return='asyncNoWait'>
</CustomAction>
<CustomAction Id="UninstallSDK"
Directory="dirCF50D58BC65CC93005501980AACC3EDD"
ExeCommand='MsiExec.exe /X{C39967EA-A3DB-4B49-9BCA-74E4D0007533}'
Execute='deferred'
Impersonate='no'
Return='asyncNoWait'>
</CustomAction>
安裝順序:
<InstallExecuteSequence>
<Custom Action="RegisterFP7000" After="InstallFinalize">NOT Installed</Custom>
<Custom Action="UnregisterFP7000" Before="InstallFinalize">REMOVE="ALL"</Custom>
<Custom Action="InstallSDK" After="InstallFiles">NOT Installed</Custom>
<Custom Action="UninstallSDK" Before="InstallFinalize">REMOVE="ALL"</Custom>
</InstallExecuteSequence>
這種注冊失敗通常是因為Dll缺少依賴項(假設其他所有方法都正確)而無法加載。 其他問題可能包括運行regsvr32的位數錯誤(例如64位版本)並嘗試注冊32位Dll。
無論如何,都不需要這樣做。 最佳做法和推薦方法是使用Heat.exe將注冊數據收集到wxs文件中,因此安裝將僅在執行安裝時創建正確的注冊表項。
首先,為您的設置創建一個詳細的日志文件 ,以便您可以找到由msiexec記錄的錯誤消息:
msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"
快速說明:
/L*V "C:\Temp\msilog.log"= verbose logging
/QN = run completely silently
/i = run install sequence
按照以下說明打開日志文件並搜索“ value 3 ”: http : //robmensching.com/blog/posts/2010/8/2/the-first-thing-i-do-with-an-msi-log /
來源鏈接:
編輯:再次查看您的代碼,我很確定問題是:
我離開的是我之前寫的更長的答案:
除了Phil的回答外, 不建議將Intel SDK設置作為自定義操作進行安裝 。 MSI禁止運行兩個並發的InstallExecuteSequence會話,這很可能是您所看到的錯誤的原因。
嘗試刪除當前用於安裝MSI的自定義操作,而先作為兩個MSI文件的鏈式安裝的一部分來運行SDK安裝程序,以查看是否可以解決問題。
出於多種原因,不應使用自我注冊來注冊COM文件:
除此之外,如果您堅持使用自我注冊,則在編譯MSI文件時不應使用任何硬編碼的路徑 。 忽略了您應該使用正確的COM提取將Phil文件注冊為Phil指出的事實,應刪除regsvr32.exe的路徑,以便使用AppSearch / FileSearch條目,該條目將在您要安裝到的系統上找到regsvr32.exe。 DLL應該安裝到%ProgramFiles%\\ Your Company Name \\ Your Project Name \\或類似目錄下的本地路徑,然后注冊以從那里運行。 生成的WIX代碼將類似於:
ExeCommand='[PATHTOREGSVR32]regsvr32.exe /s "[INSTALLDIR]FP7000-Camera.dll"'>
也許也閱讀這些文章:
在代碼示例中添加一個簡短的答案,現在暫時保留我的其他答案:
您需要將FP7000-Camera.dll文件安裝到Program Files下的目錄中,然后在該目錄中注冊。 以下是在CodeProject上找到的示例的快速模型: http : //www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with
<?xml version="1.0"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" UpgradeCode="put-guid-here" Name="Example Product Name" Version="0.0.1" Manufacturer="Example Company Name" Language="1033"> <Package InstallerVersion="200" Compressed="yes" Comments="Windows Installer Package"/> <Media Id="1" Cabinet="product.cab" EmbedCab="yes"/> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder"> <Directory Id="INSTALLDIR" Name="Example"> <Component Id="FP7000-Camera.dll" Guid="*"> <File Id="FP7000-Camera.dll" Source="replace with path to FP7000-Camera.dll"/> </Component> </Directory> </Directory> </Directory> <Feature Id="DefaultFeature" Level="1"> <ComponentRef Id="FP7000-Camera.dll"/> </Feature> </Product> </Wix>
您還應該刪除 dll 的自注冊 ,而是將COM注冊添加到將文件安裝到磁盤的組件中。 在此處查看示例: 如何在WiX 3中注冊Win32 COM DLL文件? (運行Wix工具heat.exe生成要包含在組件中的COM數據)。 如果正確執行此操作,則無需自行注冊文件,您可以刪除自定義操作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.