首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法让Wix自定义操作在Votive/VS2010中工作

无法让Wix自定义操作在Votive/VS2010中工作
EN

Stack Overflow用户
提问于 2011-04-30 03:02:30
回答 2查看 1.3K关注 0票数 1

帮助!我需要在我的Wix3.5安装项目中执行一个托管的自定义操作,无论我做了什么尝试,我都不能让它工作。

我使用的是Visual Studio2010中的Votive集成。我的Wix Product.wxs文件与visual studio模板基本相同,只有几处文本更改:

代码语言:javascript
复制
<?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.dllWIX.CustomActions.CA.dll

我看到Wix在构建期间正在处理引用,并且WIX.CustomActions.dll程序集显示在最终设置项目的二进制表格中,但WIX.CustomActions.CA.dll没有。

我有一个应该打包并调用自定义操作的CustomActions.wxs

代码语言:javascript
复制
    <?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文件中。我已经尽我所能地遵循了示例,但我看不出有什么问题。

求求你,有没有人能让这个在誓言中发挥作用?你能给我一个实际工作的例子吗?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2011-04-30 03:49:55

您需要一个从产品到片段的引用(例如,CustomActionRef);否则,它将被智能链接器丢弃。

票数 4
EN

Stack Overflow用户

发布于 2011-04-30 04:58:54

根据Bob Arnson的建议,我在Product.wxs文件的顶部附近添加了以下两行:

代码语言:javascript
复制
<CustomActionRef Id="RegisterDriver"/>
<CustomActionRef Id="UnregisterDriver"/>

这似乎已经做到了这一点。Orca现在显示我有一个二进制表格,其中包含我的CA和InstallExecuteSequence中的一个CustomAction条目。

我在网上找到的例子中没有一个提到这个要求。我猜人们只是在很少或根本不理解的情况下重复使用收到的智慧。这就是答案,感谢Bob!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/5836238

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档