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

发布于 2024-11-03 20:09:32 字数 3274 浏览 0 评论 0原文

帮助!我需要在 Wix 3.5 安装项目中执行托管自定义操作,无论我尝试什么,都无法让它工作。

我在 Visual Studio 2010 中使用 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>

我已设置对我的托管自定义操作项目的引用,将 HARVEST 属性设置为 true。该项目名为 WIX.CustomActions 并生成 WIX.CustomActions.dllWIX.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>

我查看了互联网上的各种“howto”源,它们充其量是令人困惑的,并且提供了相互矛盾的建议。据我了解,WIX.CustomActions.CA.dll 文件是一个非托管 dll,它加载 .NET 框架并将控制权传递给“真正的”托管自定义操作。但是,WIX.CustomActions.CA.dll 未打包到我的 MSI 文件中。我已尽我所能地遵循示例,但我看不出有什么问题。

请问有人在 Votive 中实现过这个功能吗?你能给我一个实际的工作例子吗?

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.

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>

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

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.

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>

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.

Please, has anyone got this working in Votive? Can you give me an actual working example?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冰火雁神 2024-11-10 20:09:32

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

You need a reference (e.g., CustomActionRef) from your product to the fragment; otherwise, it's discarded by the smart linker.

小女人ら 2024-11-10 20:09:32

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

<CustomActionRef Id="RegisterDriver"/>
<CustomActionRef Id="UnregisterDriver"/>

这似乎已经成功了。 Orca 现在显示我有一个二进制表,其中包含我的 CA dll,以及 InstallExecuteSequence 中的 CustomAction 条目。

我在网上找到的例子都没有提到这个要求。我猜人们只是在回收公认的智慧,但很少或根本不了解。这就是答案,谢谢鲍勃!

Following on from Bob Arnson's suggestion, I added the following two lines near the top of my Product.wxs file:

<CustomActionRef Id="RegisterDriver"/>
<CustomActionRef Id="UnregisterDriver"/>

That seems to have done the trick. Orca now shows that I have a Binary table, containing my CA dll, and a CustomAction entry in InstallExecuteSequence.

None of the examples I found on the web mentioned this requirement. I guess people were just recycling received wisdom with little or no understanding. So here is the answer, thanks to Bob!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文