在客户端计算机上运行wix安装程序是否需要在该计算机上安装wix框架?

时间:2017-02-06 08:52:28

标签: c# wix .net-4.5 custom-action

我已经为我的桌面应用程序创建了一个wix安装程序。我已经为它添加了一些自定义操作。安装程序在我的开发机器上工作正常,但自定义操作没有在客户端机器上调用。所以,我应该安装wix框架在客户端计算机上以使自定义操作起作用?或者我是否必须在计算机上安装Windows安装程序? 请注意,在客户端计算机上安装后,应用程序确实显示在添加或删除程序中。只是自定义操作没有被调用。我正在使用wix 3.10.3.3007。 自定义操作项目基于.net framework 4.5。其配置文件的内容如下:

<?xml version="1.0" encoding="utf-8" ?> <configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">

        <!--
          Use supportedRuntime tags to explicitly specify the version(s) of the .NET Framework runtime that
          the custom action should run on. If no versions are specified, the chosen version of the runtime
          will be the "best" match to what Microsoft.Deployment.WindowsInstaller.dll was built against.

          WARNING: leaving the version unspecified is dangerous as it introduces a risk of compatibility
          problems with future versions of the .NET Framework runtime. It is highly recommended that you specify
          only the version(s) of the .NET Framework runtime that you have tested against.

          Note for .NET Framework v3.0 and v3.5, the runtime version is still v2.0.

          In order to enable .NET Framework version 2.0 runtime activation policy, which is to load all assemblies 
          by using the latest supported runtime, @useLegacyV2RuntimeActivationPolicy="true".

          For more information, see http://msdn.microsoft.com/en-us/library/bbx34a2h.aspx
        -->

        <supportedRuntime version="v4.0" />
        <supportedRuntime version="v2.0.50727"/>

    </startup>

    <!--
      Add additional configuration settings here. For more information on application config files,
      see http://msdn.microsoft.com/en-us/library/kza1yk3a.aspx
    -->

</configuration>

此外,这里是在Product.wxs文件中调用自定义操作的代码:

  <CustomAction Id="UninstallSetPro"   Execute="immediate" Property="SectionName"  Value="Uninstall" />
    <CustomAction Id="InstallSetPro" Execute="immediate" Property="SectionName" Value="Install" />
    <CustomAction Id="Install" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="RegistryInstall"   />
    <CustomAction Id="Uninstall" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="RegistryInstall"   />
    <CustomAction Id="CopyOrderingFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="CopyOrderingFile"  />
    <CustomAction Id="ModifyConfigFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="modifyConfigFile"  />
    <CustomAction Id="AddInstallationParamToConfigFile" Return="check"  Execute="immediate"  BinaryKey="CustomAction_OutlookPlugin"  DllEntry="AddInstallationParametersToConfigFile"  />
    <InstallExecuteSequence>
      <Custom Action="InstallSetPro" After="WriteRegistryValues" >$ProductFiles&gt;2</Custom>
      <Custom Action="Install" After="InstallSetPro">$ProductFiles&gt;2</Custom>
      <Custom Action="CopyOrderingFile"  After="InstallFinalize">NOT Installed</Custom>
      <Custom Action="ModifyConfigFile"  After="InstallFinalize">NOT Installed</Custom>
      <Custom Action="AddInstallationParamToConfigFile"  After="ModifyConfigFile">NOT Installed</Custom>
      <Custom Action="UninstallSetPro" After="MsiUnpublishAssemblies" > $ProductFiles=2</Custom>
      <Custom Action="Uninstall" After="UninstallSetPro">$ProductFiles=2</Custom>
    </InstallExecuteSequence>

编辑 - 另外,我注意到的另一件事是当我跑

  

Setup.exe -l LogFile.txt

命令用于我的计算机上的日志,我能够看到安装程序UI,但在客户端计算机上没有显示安装程序UI。它会以静默方式安装它。

编辑2 - 我已经看到了日志文件,它们显示自定义操作已被调用并且它们返回1.但是自定义操作中的代码没有执行,因为当控件到达第一个时,我在那里添加了代码以写入日志文件自定义操作函数的行。这是安装程序日志中的摘录,其中显示自定义操作被调用:

  

动作结束时间:10:27:49:WriteRegistryValues。返回值1. MSI(s)   (8C:2C)[10:27:49:161]:采取行动:InstallSetPro MSI(8C:2C)   [10:27:49:161]:注意:1:2205 2:3:ActionText动作10:27:49:   InstallSetPro。动作开始10:27:49:InstallSetPro。 MSI(8C:2C)   [10:27:49:161]:PROPERTY CHANGE:添加SectionName属性。它的   价值是&#39;安装&#39;。行动结束10:27:49:InstallSetPro。返回值   1. MSI(8C:2C)[10:27:49:161]:采取行动:安装MSI(8C:2C)[10:27:49:161]:注意:1:2205 2 :3:ActionText动作   10:27:49:安装行动开始10:27:49:安装。 MSI(s)(8C:C4)   [10:27:49:208]:调用远程自定义操作。 DLL:   C:\ Windows \ Installer \ MSI77C0.tmp,入口点:RegistryInstall MSI(s)   (8C:C0)[10:27:49:317]:生成随机cookie。 MSI(s)(8C:C0)   [10:27:49:348]:使用PID 5356(0x14EC)创建自定义操作服务器。   MSI(s)(8C:34)[10:27:49:458]:作为服务运行。 MSI(8C:34)   [10:27:49:458]:您好,我是您的32位模拟自定义操作   服务器。 SFXCA:将自定义操作提取到临时目录:   C:\ Windows \ Installer \ MSI77C0.tmp- \ SFXCA:绑定到CLR版本   v4.0.30319调用自定义操作   Installer_CustomActions!Installer_CustomActions.CustomActions.RegistryInstall   行动结束10:27:50:安装。返回值1。

我在自定义操作项目中引用的用于编写日志的dll是否会导致问题?

2 个答案:

答案 0 :(得分:0)

不,您不需要安装WiX来运行CA.

我假设您的setup.exe是一个刻录引导程序,它正在执行UI并告诉主MSI以静默方式运行。

我还注意到这些自定义操作都设置为在即时执行上下文中运行。这可能是一个不正确的设计。我会读到:

http://www.installsite.org/pages/en/isnews/200108/

Custom Action in C# used via WiX fails with error 1154

我的猜测是你的条件不是评估你的思维方式而且自定义动作没有运行。无论是那个还是他们失败并吞下错误。您需要阅读日志文件以了解更多信息。

答案 1 :(得分:0)

问题在于注册表项。自定义操作无法读取注册表,因此无法正确安装。