帮助!我需要在我的Wix3.5安装项目中执行一个托管的自定义操作,无论我做了什么尝试,我都不能让它工作。
我使用的是Visual Studio2010中的Votive集成。我的Wix Product.wxs文件与visual studio模板基本相同,只有几处文本更改:
<?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>
我已经设置了对托管自定义操作项目的引用,请将采集属性设置为true。该项目名为WIX.CustomActions,生成WIX.CustomActions.dll和WIX.CustomActions.CA.dll
我看到Wix在构建期间正在处理引用,并且WIX.CustomActions.dll程序集显示在最终设置项目的二进制表格中,但WIX.CustomActions.CA.dll没有。
我有一个应该打包并调用自定义操作的CustomActions.wxs:
<?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>我已经看过互联网上各种“如何操作”的资源,它们充其量是令人困惑的,带有相互矛盾的建议。据我所知,WIX.CustomActions.CA.dll文件是一个非托管dll,它加载.NET框架并将控制传递给“真正的”托管自定义操作。但是,WIX.CustomActions.CA.dll不会打包到我的MSI文件中。我已经尽我所能地遵循了示例,但我看不出有什么问题。
求求你,有没有人能让这个在誓言中发挥作用?你能给我一个实际工作的例子吗?
发布于 2011-04-30 03:49:55
您需要一个从产品到片段的引用(例如,CustomActionRef);否则,它将被智能链接器丢弃。
发布于 2011-04-30 04:58:54
根据Bob Arnson的建议,我在Product.wxs文件的顶部附近添加了以下两行:
<CustomActionRef Id="RegisterDriver"/>
<CustomActionRef Id="UnregisterDriver"/>这似乎已经做到了这一点。Orca现在显示我有一个二进制表格,其中包含我的CA和InstallExecuteSequence中的一个CustomAction条目。
我在网上找到的例子中没有一个提到这个要求。我猜人们只是在很少或根本不理解的情况下重复使用收到的智慧。这就是答案,感谢Bob!
https://stackoverflow.com/questions/5836238
复制相似问题