Wix 和自定义 .net dll

发布于 2024-10-06 11:22:46 字数 298 浏览 0 评论 0原文

我正在寻找一些参考.NET dll的wix​​项目的完整示例(完整的wix VS项目、.net dll VS项目和编译的.net dll)。

我正在尝试运行 SampleAskKeyNet,但不断收到错误“此 Windows Installer 程序包存在问题。无法运行完成此安装所需的 DLL。请联系您的支持人员或程序包供应商,我正在尝试查找我做错了什么。

我在VS中创建了wix项目,在VS中创建了.net dll项目,编译了dll项目,将CheckPidPackage.dll复制到wix VS项目目录并编译了wix项目,然后我得到了这个错误。

I'm searching for some complete sample of wix project with reference to .NET dll (complete wix VS project, .net dll VS project, and compiled .net dll).

I'm trying to run SampleAskKeyNet and constantly I got error "There is a problem with this Windows Installer package. A DLL required for this installation to complete could not be run. Contact your support personnel or package vendor and I'm trying to find what I made wrong.

I created wix project in VS, .net dll project in VS, compiled dll project, copy over CheckPidPackage.dll to wix VS project directory and compile wix project. Then I run it and I get this error.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

遥远的绿洲 2024-10-13 11:22:46

接受的答案(由 user431821 提供)中提到的链接确实有帮助,但发布了对我有帮助的确切内容。

自定义操作项目创建 2 个 dll。如果项目是 CustomActionProject,它将创建 CustomActionProject.dllCustomActionProject.CA.dll

我引用的是 CustomActionProject.dll,如下所示,它是常规 dll。

<Binary Id="CustomActionProject"
     src="..\CustomActionProject\bin\$(var.Configuration)\CustomActionProject.dll" />
<CustomAction Id="MyAction"
    Return="check"
    BinaryKey="CustomActionProject"                  
    DllEntry="Validate"/>

WIX 创建 CustomActionProject.CA.dll,它实际上不是 .NET 托管程序集,而是非托管程序集。所以我们必须引用它而不是常规的。

<Binary Id="CustomActionProject"
     src="..\CustomActionProject\bin\$(var.Configuration)\CustomActionProject.CA.dll" />
<CustomAction Id="MyAction"
    Return="check"
    BinaryKey="CustomActionProject"                  
    DllEntry="Validate"/>

这解决了我的问题。

Link mentioned in accepted answer(by user431821) was indeed helpful but posting the exact thing which was helpful to me.

Custom actions project creates 2 dlls. If project is CustomActionProject, it will create CustomActionProject.dll and CustomActionProject.CA.dll

I was referencing to CustomActionProject.dll as below which is regular dll.

<Binary Id="CustomActionProject"
     src="..\CustomActionProject\bin\$(var.Configuration)\CustomActionProject.dll" />
<CustomAction Id="MyAction"
    Return="check"
    BinaryKey="CustomActionProject"                  
    DllEntry="Validate"/>

WIX creates CustomActionProject.CA.dll which is actually NOT the .NET managed assembly but unmanaged assembly. SO we have to refer to it instead of regular one.

<Binary Id="CustomActionProject"
     src="..\CustomActionProject\bin\$(var.Configuration)\CustomActionProject.CA.dll" />
<CustomAction Id="MyAction"
    Return="check"
    BinaryKey="CustomActionProject"                  
    DllEntry="Validate"/>

This solved my issue.

小傻瓜 2024-10-13 11:22:46

对我来说,这是我的 CustomAction DllEntry 与我的方法名称不匹配。 IE

<CustomAction Id="CheckingPID" BinaryKey="CheckPID.CA" DllEntry="BadValue" />

public static ActionResult CheckPID(Session session)

For me, it was my CustomAction DllEntry did not match my method name. i.e.

<CustomAction Id="CheckingPID" BinaryKey="CheckPID.CA" DllEntry="BadValue" />

public static ActionResult CheckPID(Session session)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文