使用 WIX 创建 MSI 设置。CA.DLL 找不到文件
Create MSI setup with WIX .CA.DLL file not found
我正在尝试构建 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 文件。
我在这里错过了什么?
Download Sample Project: Most likely there is something wrong with the compilation of that zip / win32 dll (as opposed to the
managed code dll) - please see if you can compile this project
outright - "right out of the box":
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: For the record, the building of the CustomAction1.CA.dll
file involves zipping up the managed code dll version CustomAction1.dll
and also its dependencies in a Win32 binary. The file MakeSfxCA.exe (Firegiant's documentation page) is a DTF file (Deployment Tools Foundation). More details here.
DTF.chm:DTF.chm
[=37 中有更多文档=] 帮助文件位于 WiX 安装目录的“doc”子文件夹中(通常为:"%ProgramFiles(x86)%\WiX Toolset v3.11\doc\DTF.chm"
)- 搜索 MakeSfxCA.exe
.
我正在尝试构建 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 文件。
我在这里错过了什么?
Download Sample Project: Most likely there is something wrong with the compilation of that zip / win32 dll (as opposed to the managed code dll) - please see if you can compile this project outright - "right out of the box": 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: For the record, the building of the CustomAction1.CA.dll
file involves zipping up the managed code dll version CustomAction1.dll
and also its dependencies in a Win32 binary. The file MakeSfxCA.exe (Firegiant's documentation page) is a DTF file (Deployment Tools Foundation). More details here.
DTF.chm:DTF.chm
[=37 中有更多文档=] 帮助文件位于 WiX 安装目录的“doc”子文件夹中(通常为:"%ProgramFiles(x86)%\WiX Toolset v3.11\doc\DTF.chm"
)- 搜索 MakeSfxCA.exe
.