簡體   English   中英

WIX自定義操作:使用dllimport

[英]WIX custom action: use dllimport

我有一個WiX安裝程序和“自定義操作”項目。 我添加了C#庫作為對“自定義操作”項目的引用。 此C#dll使用DllImport到一個C ++ dll。 安裝時收到錯誤消息:無法加載DLL mycpp.dll :找不到指定的模塊。 我將mycpp.dll添加到CA項目,並嘗試使用屬性:嵌入資源,復制到輸出目錄-但沒有結果。 如何使我的安裝程序找到mycpp.dll

我以前有過這個問題。 仔細閱讀wix的MSBuild文件后,我最終找到了一個屬性,該屬性用作包含自定義操作dll的自解壓程序包中所需dll的列表。

在wix.ca.targets中(在sdk文件夾中),有一個名為CustomActionContents的屬性,在運行makefxca時使用。

這是這套msbuild目標的注釋,這些目標打包了您的自定義操作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,它將被拾取。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM