我有一个 WiX 安装程序和自定义操作项目。我添加了 C# 库作为自定义操作项目的参考。此 C# dll 使用 DllImport 到一个 C++ dll。安装时收到错误:无法加载 DLLmycpp.dll
: 未找到指定的模块。我添加了mycpp.dll
到 CA 项目并尝试使用属性:嵌入资源,复制到输出目录 - 但没有结果。我怎样才能让我的安装程序找到mycpp.dll
?
我以前也遇到过这个问题。在阅读了 wix 的 MSBuild 文件后,我最终找到了一个属性,该属性用作包含自定义操作 dll 的自解压包中所需的 dll 的列表。
在wix.ca.targets(在sdk文件夹中)中有一个名为CustomActionContents的属性,在运行makesfxca时使用。
这是对打包自定义操作 dll 的这组 msbuild 目标的注释。
<!--
==================================================================================================
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.
==================================================================================================
-->
and
<!--
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,它就会被拾取。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)