5

首先,为混淆的屏幕截图道歉,并且不包括代码中的全名。

我在尝试使用 Wix 框架从 dll 中使用自定义操作时遇到问题。

我正在使用 Wix 3.10.2

我的解决方案下有一个名为 Install.CustomAction 的 C# 自定义操作项目。然后在主要的 Wix 项目中引用它。你可以在这里看到

在此处输入图像描述

我在主 Product.wxs 文件中将 CA dll 引用为二进制文件

<Binary Id="CustomActions.dll" SourceFile="$(var.<porjectname>.Install.CustomAction.TargetDir)<projectname>.CustomAction.CA.dll"/>

现在在一个片段中,我有这样引用的动作

<CustomAction Id="CA_RestoreDB" BinaryKey="CustomActions.dll" DllEntry="RestoreMobileDB" Execute="immediate" Return="check" />
<InstallExecuteSequence>
  <Custom Action="CA_RestoreDB" After="InstallFinalize"/>
</InstallExecuteSequence>

到目前为止,我希望一切正常。

在名为 CustomAction.cs 的实际 c# 文件中,我使用 [CustomAction] 属性进行了此设置

[CustomAction]

public ActionResult RestoreMobileDB(Session session)
{
    //string installPath = session.GetTargetPath(TARGETDIR);
    string x = session["INSTALLFOLDER"];
    session.Log("Begin CustomAction1");
    doSomeStuff(x, session);

    return ActionResult.Success;
}

到目前为止,一切看起来都很好,并且正在按照我的预期工作。但是当我来编译所有东西时,我得到了这个错误

    Severity    Code    Description Project File    Line    Suppression State
Error       The command ""C:\Program Files (x86)\WiX Toolset v3.10\bin\..\sdk\MakeSfxCA.exe" "C:\Work Files\Development\<product>\<solution>\<project>.Install.CustomAction\obj\x86\Release\<project>.Install.CustomAction.CA.dll" "C:\Program Files (x86)\WiX Toolset v3.10\bin\..\sdk\x86\SfxCA.dll" "C:\Work Files\Development\<product>\<solution>\<project>Install.CustomAction\obj\x86\Release\<project>.Install.CustomAction.dll" "C:\Program Files (x86)\WiX Toolset v3.10\SDK\Microsoft.Deployment.WindowsInstaller.dll;C:\Work Files\Development\<product>\<solution>\<project>.Install.CustomAction\CustomAction.config"" exited with code 1.    <project>.Install.CustomAction

跟着这个错误

在模块中找不到 CA 或 UI 入口点

你知道是什么原因造成的吗?我已经指定了一个入口点并在我的 .wxs 文件中引用了 dll,但它似乎对我不起作用。

4

1 回答 1

5

我认为它需要是:

public static ActionResult ...
于 2016-02-09T18:47:22.490 回答