WIX自定义操作:使用dllimport [英] WIX custom action: use dllimport

查看:131
本文介绍了WIX自定义操作:使用dllimport的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个WiX安装程序和自定义操作"项目.我添加了C#库作为对自定义操作"项目的引用.此C#dll使用DllImport到一个C ++ dll.安装时收到错误消息:无法加载DLL mycpp.dll:找不到指定的模块.我将mycpp.dll添加到CA项目,并尝试使用属性:嵌入资源,复制到输出目录-但没有结果.如何让我的安装程序找到mycpp.dll?

I have a WiX installer and Custom Actions project. I added C# library as reference to Custom action's project. This C# dll uses DllImport to one C++ dll. When installing I receive error: cannot load DLL mycpp.dll : specified module not found. I added mycpp.dll to CA project and tried using properties : embedded resource, copy to output directory - but no result. How can I make my installer find mycpp.dll?

推荐答案

我以前遇到过此问题.仔细阅读wix的MSBuild文件后,我最终找到了一个属性,该属性用作包含自定义操作dll的自解压程序包中所需dll的列表.

I've had this issue before. After reading through the MSBuild files for wix I eventually found a property that is used as a list for the dlls needed in the self-extracting package that contains the custom action dll.

在wix.ca.targets中(在sdk文件夹中),有一个名为CustomActionContents的属性,该属性在运行makefxca时使用.

in wix.ca.targets (in the sdk folder) there is a property called CustomActionContents that is used when running makesfxca.

以下是这套msbuild目标的注释,这些目标打包了您的自定义操作dll.

Here's the comment for this set of msbuild targets which package your custom action dll.

<!--
==================================================================================================
PackCustomAction

Creates an MSI managed custom action package that includes the custom action assembly,
local assembly dependencies, and project content files.

[IN]
@(IntermediateAssembly) - Managed custom action assembly.
@(Content) - Project items of type Content will be included in the package.
$(CustomActionContents) - Optional space-delimited list of additional files to include.

[OUT]
$(IntermediateOutputPath)$(TargetCAFileName) - Managed custom action package with unmanaged stub.
==================================================================================================
-->

<!--
Items to include in the CA package:
 - Reference assemblies marked CopyLocal
 - Project items of type Content
 - Additional items in the CustomActionContents property
-->

因此,您似乎可以将对mycpp.dll的引用标记为本地副本,它将被自动提取,或者可以在自定义操作项目中添加新属性(可能编辑csproj并添加该属性),包含dll的路径,它将被拾取.

So it looks like you can mark your reference to the mycpp.dll as copy local and it will be automatically picked up or you can add a new property in your custom action project (probably edit the csproj and add the property) which contains the path to the dll and it will get picked up.

这篇关于WIX自定义操作:使用dllimport的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆