无法使Wix自定义动作在Votive / VS2010中工作 [英] Can't get Wix custom action to work in Votive/VS2010
问题描述
帮助!我需要在Wix 3.5安装项目中执行托管自定义操作,无论我尝试了什么,我都无法使其正常工作。
Help! I need to execute a managed custom action in my Wix 3.5 setup project and no matter what I've tried I can't get it to work.
我正在使用Visual Studio 2010中的Votive集成。除了一些文本更改外,我的Wix Product.wxs文件与Visual Studio模板基本相同:
I'm using the Votive integration in Visual Studio 2010. My Wix Product.wxs file is basically unchanged from the visual studio template except a few text changes:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="666ffc07-90b2-4608-a9f0-a0cc879f2ad0" Name="Product Name" Language="1033" Version="5.5.0002" Manufacturer="TiGra Astronomy" UpgradeCode="d17a5991-b404-4095-9e93-08d2db984cfd">
<Package InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media1.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="Directory Name">
<!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
<!-- <Component Id="ProductComponent" Guid="3ea5ade7-9b7b-40da-9e83-13e066a000ef"> -->
<!-- TODO: Insert files, registry keys, and other resources here. -->
<!-- </Component> -->
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="ASCOM Driver" Level="1">
<!-- TODO: Remove the comments around this ComponentRef element and the Component above in order to add resources to this installer. -->
<!-- <ComponentRef Id="ProductComponent" /> -->
<!-- Note: The following ComponentGroupRef is required to pull in generated authoring from project references. -->
<ComponentGroupRef Id="Product.Generated" />
</Feature>
</Product>
我已引用在我的托管自定义操作项目中,将HARVEST属性设置为true。该项目称为 WIX.CustomActions
,并生成 WIX.CustomActions.dll
和 WIX.CustomActions .CA.dll
I have set a reference to my managed custom action project, set the HARVEST property to true. The project is called WIX.CustomActions
and produces WIX.CustomActions.dll
and WIX.CustomActions.CA.dll
我看到Wix在构建过程中正在处理引用,而 WIX.CustomActions.dll
程序集显示在最终安装项目的Binary表中,但 WIX.CustomActions.CA.dll
却没有。
I see that Wix is processing the reference during build and the WIX.CustomActions.dll
assembly shows up in the Binary table in the final setup project, but the WIX.CustomActions.CA.dll
does not.
我有一个 CustomActions.wxs
应该打包并调用自定义操作:
I have a CustomActions.wxs
that should package and invoke the custom action:
<?xml version="1.0" encoding="UTF-8" ?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<Binary Id="DriverRegistrationCA" SourceFile="$(var.WIX.CustomActions.TargetDir)\$(var.WIX.CustomActions.TargetName).CA.dll" />
<CustomAction Id="RegisterDriver" BinaryKey="DriverRegistrationCA" DllEntry="RegisterAscomDriver" Execute="deferred" Return="check" />
<CustomAction Id="UnregisterDriver" BinaryKey="DriverRegistrationCA" DllEntry="UnregisterAscomDriver" Execute="immediate" Return="check" />
<InstallExecuteSequence>
<Custom Action="RegisterDriver" After="InstallFinalize" />
<Custom Action="UnregisterDriver" Before="RemoveFiles" />
</InstallExecuteSequence>
</Fragment>
</Wix>
我看过网络上的各种 howto资源,它们充其量是令人困惑的,矛盾的意见。据我了解, WIX.CustomActions.CA.dll
文件是一个非托管dll,它加载.NET框架并将控制权传递给真实托管自定义操作。但是, WIX.CustomActions.CA.dll
没有打包在我的MSI文件中。我已尽可能地遵循示例,但看不到出了什么问题。
I've looked at various 'howto' sources on the interweb and they are at best confusing, with contradictory advice. As I understand it, the WIX.CustomActions.CA.dll
file is an unmanaged dll that loads the .NET framework and passes control to the 'real' managed custom action. However, the WIX.CustomActions.CA.dll
does not get packaged in my MSI file. I've followed examples as best I can but I can't see what's wrong.
请问,有人在Votive中工作过吗?您能给我一个实际的工作示例吗?
Please, has anyone got this working in Votive? Can you give me an actual working example?
推荐答案
您需要从产品到片段的引用(例如CustomActionRef);否则,它会被智能链接器丢弃。
You need a reference (e.g., CustomActionRef) from your product to the fragment; otherwise, it's discarded by the smart linker.
这篇关于无法使Wix自定义动作在Votive / VS2010中工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!