0
我有一个WiX安装程序和自定义操作项目。我添加了C#库作为自定义操作项目的参考。这C#dll使用DllImport到一个C++ dll。安装时收到错误:无法加载DLL mycpp.dll
:未找到指定的模块。我将mycpp.dll
添加到CA项目,并尝试使用属性:嵌入式资源,复制到输出目录 - 但没有结果。我怎样才能让我的安装程序找到mycpp.dll
?WIX自定义操作:使用dllimport
我有一个WiX安装程序和自定义操作项目。我添加了C#库作为自定义操作项目的参考。这C#dll使用DllImport到一个C++ dll。安装时收到错误:无法加载DLL mycpp.dll
:未找到指定的模块。我将mycpp.dll
添加到CA项目,并尝试使用属性:嵌入式资源,复制到输出目录 - 但没有结果。我怎样才能让我的安装程序找到mycpp.dll
?WIX自定义操作:使用dllimport
我以前有过这个问题。在阅读完MSBuild文件的wix后,我最终找到了一个属性,该属性用作包含自定义动作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.
==================================================================================================
-->
和
<!--
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的路径,它会被拾取。