简体   繁体   English

Wix MSI仅在一台计算机上工作

[英]Wix MSI Only Works on One Computer

I recently finished my first Wix Intaller, however I have a problem, My MSI file only works on my computer, I am generating an embedded CAB file. 我最近完成了我的第一个Wix Intaller,但是我有一个问题,我的MSI文件仅在我的计算机上有效,我正在生成嵌入式CAB文件。 I am registering a DLL within the installer. 我正在安装程序中注册DLL。 I get the error : "There is a problem with this Windows Installer Package. A program run as part of the setup did not finish as expected." 我收到错误消息:“此Windows Installer软件包存在问题。作为安装程序一部分运行的程序未按预期完成。” This is why I believe the DLL is part of the problem. 这就是为什么我认为DLL是问题的一部分的原因。 I have some code snippets below, if you need to see more let me know, Thanks! 我在下面提供了一些代码段,如果您需要查看更多代码段,请告诉我,谢谢!

Custom Action for DLL Install: 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> 

Install Sequence: 安装顺序:

<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>

Registration failures of this sort are typically because the Dll won't load because it has missing dependencies (assuming that everything else is correct). 这种注册失败通常是因为Dll缺少依赖项(假设其他所有方法都正确)而无法加载。 Other issues might include running the wrong bitness of regsvr32 (for example the 64-bit version) and trying to register a 32-bit Dll. 其他问题可能包括运行regsvr32的位数错误(例如64位版本)并尝试注册32位Dll。

In any case, there is no need to do this. 无论如何,都不需要这样做。 The best practice and recommended way to do this is to use Heat.exe to harvest the registration data into a wxs file, so the install will just create the correct registry entries when you do the install. 最佳做法和推荐方法是使用Heat.exe将注册数据收集到wxs文件中,因此安装将仅在执行安装时创建正确的注册表项。

How do you register a Win32 COM DLL file in WiX 3? 如何在WiX 3中注册Win32 COM DLL文件?

First of all, create a verbose log file for your setup so you can find error messages logged by msiexec: 首先,为您的设置创建一个详细的日志文件 ,以便您可以找到由msiexec记录的错误消息:

msiexec.exe /i c:\setup.msi /QN /L*V "C:\Temp\msilog.log"

Quick explanation: 快速说明:

 /L*V "C:\Temp\msilog.log"= verbose logging
 /QN = run completely silently
 /i = run install sequence 

Open the log file and search for " value 3 " as explained here: http://robmensching.com/blog/posts/2010/8/2/the-first-thing-i-do-with-an-msi-log/ 按照以下说明打开日志文件并搜索“ value 3 ”: http : //robmensching.com/blog/posts/2010/8/2/the-first-thing-i-do-with-an-msi-log /

Source Links: 来源链接:


EDIT: Looking over your code again I am pretty sure the problems are: 编辑:再次查看您的代码,我很确定问题是:

  1. You install an embedded runtime setup via a custom action. 您可以通过自定义操作安装嵌入式运行时设置 This should not be run via a custom action but as a pre-requisite setup run before your own MSI file. 这不应通过自定义操作运行,而应作为必备设置在您自己的MSI文件之前运行。
  2. You specify hard coded paths to the dll rather than installing the dll to the main installation directory and registering it there. 您可以指定dll的硬编码路径 ,而不是将dll安装到主安装目录并在其中注册。 This means the setup will only work on your system since that is the only machine with the dll available in that particular location. 这意味着安装程序仅在您的系统上起作用,因为那是该特定位置上唯一具有dll的计算机。

I am leaving in the previous, longer answer that I wrote first: 我离开的是我之前写的更长的答案:


Just in addition to Phil's answer: installing the Intel SDK setup as a custom action is not advisable . 除了Phil的回答外, 不建议将Intel SDK设置作为自定义操作进行安装 MSI prohibits running two concurrent InstallExecuteSequence sessions and this could very well be the cause of the error you are seeing. MSI禁止运行两个并发的InstallExecuteSequence会话,这很可能是您所看到的错误的原因。

Try removing your custom actions currently used to install the MSI and instead run the SDK setup first as part of a chained install of your two MSI files to see if this resolves the problem. 尝试删除当前用于安装MSI的自定义操作,而先作为两个MSI文件的链式安装的一部分来运行SDK安装程序,以查看是否可以解决问题。

COM files should not be registered using self-registration for many reasons: 出于多种原因,不应使用自我注册来注册COM文件:

Other than that, if you insist on using self-registration, you should not use any hard coded paths when compiling an MSI file. 除此之外,如果您坚持使用自我注册,则在编译MSI文件时不应使用任何硬编码的路径 Overlooking the fact that you should register COM files as Phil points out using proper COM extraction, the path to regsvr32.exe should be removed in favor of an AppSearch / FileSearch entry that will locate the regsvr32.exe on the system you are installing to. 忽略了您应该使用正确的COM提取将Phil文件注册为Phil指出的事实,应删除regsvr32.exe的路径,以便使用AppSearch / FileSearch条目,该条目将在您要安装到的系统上找到regsvr32.exe。 The DLL should be installed to a local path under %ProgramFiles%\\Your Company Name\\Your Project Name\\ or similar and then registered to run from there. DLL应该安装到%ProgramFiles%\\ Your Company Name \\ Your Project Name \\或类似目录下的本地路径,然后注册以从那里运行。 The resulting WIX code would be something like: 生成的WIX代码将类似于:

ExeCommand='[PATHTOREGSVR32]regsvr32.exe /s "[INSTALLDIR]FP7000-Camera.dll"'>

Perhaps have a read of these article too: 也许也阅读这些文章:

Adding a shorter answer with a code sample, leaving in my other answer for now: 在代码示例中添加一个简短的答案,现在暂时保留我的其他答案:

  • You need to install the FP7000-Camera.dll file to a directory under Program Files and register it there. 您需要将FP7000-Camera.dll文件安装到Program Files下的目录中,然后在该目录中注册。 Here is a quick mock-up from a sample found on CodeProject: http://www.codeproject.com/Tips/105638/A-quick-introduction-Create-an-MSI-installer-with 以下是在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> 
  • You should also remove the self-registration of the dll and instead add the COM registration to the component installing the file to disk. 您还应该删除 dll 的自注册 ,而是将COM注册添加到将文件安装到磁盘的组件中。 See a sample here: How do you register a Win32 COM DLL file in WiX 3? 在此处查看示例: 如何在WiX 3中注册Win32 COM DLL文件? (run the Wix tool heat.exe to generate the COM data to include in your component). (运行Wix工具heat.exe生成要包含在组件中的COM数据)。 If you do this properly there is no need to self-register the file and you can remove the custom actions to do so. 如果正确执行此操作,则无需自行注册文件,您可以删除自定义操作。

  • Finally you should not install the SDK runtime MSI as a custom action, but run it first as a pre-requisite for your MSI. 最后,你应该安装SDK运行MSI作为一个自定义操作,但首先运行它作为一个先决条件的MSI。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM