c# - 使用未找到 WIX .CA.DLL 文件创建 MSI 设置
问题描述
我正在尝试构建 WIX 设置,但它一直失败。
Error The system cannot find the file 'C:\Work\Test\CustomActionForm\bin\Debug\CustomActionForm.CA.dll'.
我的 product.wxs 文件
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="SetupProject4" Language="1033" Version="1.0.0.0" Manufacturer="MSPmate" UpgradeCode="b9c48ec5-2f0a-4c74-abc6-0c98119861d4">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
<MediaTemplate EmbedCab="yes" />
<Feature Id="ProductFeature" Title="SetupProject4" Level="1">
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<InstallExecuteSequence>
<Custom Action='CustomActionFormId' Before='InstallFinalize'>NOT Installed</Custom>
</InstallExecuteSequence>
</Product>
<Fragment>
<Binary Id="CustomActionBinary" SourceFile="$(var.CustomActionForm.TargetDir)$(var.CustomActionForm.TargetName).CA.dll" />
<CustomAction Id="CustomActionFormId" Impersonate="no" BinaryKey="CustomActionBinary" DllEntry="ShowLicenseInfo" Return="check" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="SetupProject4" />
</Directory>
</Directory>
</Fragment>
<Fragment>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="ProductComponent">
<File Source="$(var.WindowsFormsApp1.TargetPath)" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
这是我的自定义操作。
namespace CustomActionForm
{
public class CustomAction
{
[CustomAction]
public static ActionResult ShowLicenseInfo(Session session)
{
try
{
session.Log("Custom Action beginning");
MessageBox.Show("Yo hoooooooooo");
// Do Stuff...
//if (cancel)
//{
// session.Log("Custom Action cancelled");
// return ActionResult.Failure;
//}
session.Log("Custom Action completed successfully");
return ActionResult.Success;
}
catch (SecurityException ex)
{
session.Log("Custom Action failed with following exception: " + ex.Message);
return ActionResult.Failure;
}
}
}
}
但是,当我构建自定义项目时,它构建成功,但甚至看不到生成 *.CA.dll 文件。
我在这里想念什么?
解决方案
下载示例项目:该 zip / win32 dll(而不是托管代码 dll)的编译很可能有问题 - 请查看您是否可以直接编译该项目 - “开箱即用”: https:/ /github.com/glytzhkof/WiXCustomActionsTesting
原因?: CA dll 可能存在简单的构建失败。您的 Visual Studio 可能有问题 - 也许。可能是完全不同的东西。请开始使用该示例项目进行测试。
构建输出:Visual Studio 构建输出应如下所示:
------ Build started: Project: CustomAction1, Configuration: Debug x86 ------
Searching for custom action entry points in CustomAction1.dll
Loaded dependent assembly: C:\Program Files (x86)\WiX Toolset v3.11\SDK\Microsoft.Deployment.WindowsInstaller.dll
CustomAction1=CustomAction1!CustomAction1.CustomActions.CustomAction1
Searching for an embedded UI class in CustomAction1.dll
Modifying SfxCA.dll stub
Copying file version info from E:\Testing\CA\obj\x86\Debug\CustomAction1.dll to E:\Testing\CA\obj\x86\Debug\CustomAction1.CA.dll
Packaging files
CustomAction1.dll
Microsoft.Deployment.WindowsInstaller.dll
CustomAction1.pdb
CustomAction.config
MakeSfxCA finished: E:\Testing\CA\obj\x86\Debug\CustomAction1.CA.dll
CustomAction1 -> E:\Testing\CA\obj\x86\Debug\CustomAction1.dll
MakeSfxCA.exe:作为记录,CustomAction1.CA.dll
文件的构建涉及压缩托管代码 dll 版本CustomAction1.dll
及其在 Win32 二进制文件中的依赖项。文件MakeSfxCA.exe(Firegiant 的文档页面)是一个 DTF 文件(部署工具基础)。更多细节在这里。
DTF.chmDTF.chm
:位于 WiX 安装目录的“doc”子文件夹(通常的帮助文件中有更多文档"%ProgramFiles(x86)%\WiX Toolset v3.11\doc\DTF.chm"
- 搜索MakeSfxCA.exe
.
推荐阅读
- python - 循环的根查找(牛顿)几个值
- angular - 将任何值解析为枚举
- node.js - Mongoose 嵌套填充 TypeError
- javascript - jQuery 列表项和菜单方法/功能
- ansible - 为模块 Ansible 设置常量参数
- xslt - 使用XSLT转置xml中的一些节点
- python - 将搜索到的查询传递到另一个视图
- android - 显示对话框时如何为活动设置动画
- udp - How to disable udp in shadowsocks or outline server without modifying Client-side code (How to modify shadowsocks server to use pure tcp (not udp))
- qt - 除了像 GTest 实现这样的可执行文件之外,在 CTest 中注册 QTest 上的测试