WIX custom action: use dllimport

此生再无相见时 提交于 2019-12-02 10:23:41

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.

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

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.
==================================================================================================
-->

and

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!