代码之家  ›  专栏  ›  技术社区  ›  Nathan

无法在MSI中运行Wix自定义操作

  •  7
  • Nathan  · 技术社区  · 14 年前

    以下是相应Wix文件中的位:

    <Binary Id="INSTALLERHELPER" SourceFile=".\Lib\InstallerHelper.dll" />
    <CustomAction Id="HelperAction" BinaryKey="INSTALLERHELPER" DllEntry="CustomAction1" Execute="immediate" />
    

    下面是我自定义操作的完整类文件:

    using Microsoft.Deployment.WindowsInstaller;
    
    namespace InstallerHelper
    {
      public class CustomActions
      {
        [CustomAction]
        public static ActionResult CustomAction1(Session session)
        {
          session.Log("Begin CustomAction1");
    
          return ActionResult.Success;
        }
      }
    }
    

    该操作通过在UI中按下按钮来运行(目前):

      <Control Id="Next" Type="PushButton" X="248" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)" >
          <Publish Event="DoAction" Value="HelperAction">1</Publish>
      </Control>
    

    MSI (c) (08:5C) [10:08:36:978]: Connected to service for CA interface.
    MSI (c) (08:4C) [10:08:37:030]: Note: 1: 1723 2: SQLHelperAction 3: CustomAction1 4: C:\Users\NATHAN~1.TYL\AppData\Local\Temp\MSI684F.tmp 
    Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SQLHelperAction, entry: CustomAction1, library: C:\Users\NATHAN~1.TYL\AppData\Local\Temp\MSI684F.tmp 
    MSI (c) (08:4C) [10:08:38:501]: Product: SessionWorks :: Judge Edition -- Error 1723. There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor.  Action SQLHelperAction, entry: CustomAction1, library: C:\Users\NATHAN~1.TYL\AppData\Local\Temp\MSI684F.tmp 
    
    Action ended 10:08:38: SQLHelperAction. Return value 3.
    DEBUG: Error 2896:  Executing action SQLHelperAction failed.
    The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2896. The arguments are: SQLHelperAction, , 
    

    它给我的两个错误代码或信息都不足以告诉我出了什么问题。或者我只是不明白他们说的是错的。

    一开始我认为这可能是因为我使用的是wix3.5,所以为了确保我尝试使用wix3.0,但我得到了相同的错误。

    你知道我做错了什么吗?

    7 回复  |  直到 12 年前
        1
  •  8
  •   Community c0D3l0g1c    7 年前

    对于自定义操作程序集,需要一个配置文件并设置 useLegacyV2RuntimeActivationPolicy 属性为 true . 请确保命名配置文件 CustomAction.config

    看到了吗 here 更多信息。另外,正如AntonyW已经指出的,fuslogvw.exe在这个场景中非常有用。

        2
  •  8
  •   Kirka121    11 年前

        3
  •  6
  •   Yan Sklyarenko    12 年前

    通过启动的自定义操作 DoAction 无法写入日志文件。

    当我第一次使用WiX的时候,我也很困惑。

    如果你想看看发生了什么,你可以用 System.Diagnostics.Debugger.Launch() 在自定义操作开始时。这将提示您将visualstudio附加到进程,以便您可以调试它。

        4
  •  1
  •   Chris Schiffhauer aleha_84    11 年前

    对我来说,这是因为我的CustomAction DllEntry与我的方法名不匹配。即

    <CustomAction Id="CheckingPID" BinaryKey="CheckPID.CA" DllEntry="BadValue" />
    
    public static ActionResult CheckPID(Session session)
    
        5
  •  1
  •   Yogesh B    10 年前

    当安装程序项目配置/平台分别设置为debug/x64和自定义操作项目配置/平台分别设置为debug/x86时,会出现此错误。

    更正平台设置以为同一平台生成项目

    就我而言,改变柏拉图主义解决了这个问题。

    谢谢 约格什

        6
  •  1
  •   user3589896    8 年前

        7
  •  0
  •   Community c0D3l0g1c    7 年前

    您尝试过更改自定义操作DLL上的运行时库设置吗?调试模式选项/MDD和/MTD需要C++运行时的调试版本,这在生产机器上是不可用的(对于它们来说没有可再分发的许可证)。如果使用/MD编译器选项,您还可能需要安装用户机器上需要的VisualStudioC++运行时版本,因此有一个合并模块: C++ Redistributable package with WIX