【发布时间】:2020-04-12 23:39:44
【问题描述】:
我在安装解决方案中有 3 个项目:
- 用 c# 编写的自定义操作 dll
- 用 c++ 编写的自定义操作 dll
- Util dll 也用 c++ 编写(c# 和 c++ 使用它,如 互操作)
问题是如何将 Util.dll 添加到 wix 安装程序中,
当我将此 dll 复制/粘贴到 C:\ProgramFiles\SystemWOW64\(msiexec.exe 目录)中时,一切正常,但这是一个糟糕的解决方法,我想避免。
我尝试过的: 1) 添加作为对 MSI 项目的引用并包括:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Binary Id="CPlusPlusAction" SourceFile="$(var.CPlusPlusAction.TargetDir)$(var.CPlusPlusAction.TargetName).CA.dll"/>
<Binary Id="CSharpAction" SourceFile="$(var.CSharpAction.TargetPath)"/>
<Binary Id="Utils" SourceFile="$(var.SolutionDir)/$(var.Utils.Configuration)/Utils.dll"/>
<CustomAction Id="FunctionOne" Impersonate="no" Return="ignore" Execute="commit" BinaryKey="CPlusPlusAction" DllEntry="FunctionOne" />
<CustomAction Id="FunctionTwo" Impersonate="no" Return="ignore" Execute="commit" BinaryKey="CSharpAction" DllEntry="FunctionTwo"/>
</Fragment>
</Wix>
2) 使用 CopyLocal = true 添加作为对两个项目的引用
我搜索了很多,但仍然找不到解决方案(Wix Doc、StackOverflow、msdn 等)
提前致谢
【问题讨论】:
-
可能很愚蠢,但是您可以尝试为它添加一个 CustomAction,并且永远不要对操作进行排序吗?
-
我不推荐托管代码。尽可能使用 C++,但如果您:1)
Right click the Custom Action project, 2) 选择Addb>=>Existing Item...=>3)Add the C++ DLL?重新构建并在输出窗口中查看 dll 是否已编译为托管代码 (DTF) 的FileName.CA.dllWin32 包装 dll。 -
也许还要注意任何位问题? Here is an answer on this topic.
-
又是2007年吗?如今,托管的自定义操作很好。 DTF 会为您打包您的依赖项,让这个问题变得毫无意义。
标签: c# c++ dependencies wix windows-installer