让 Wix Votive 注册 COM 对象

发布于 2024-09-28 04:07:25 字数 1211 浏览 1 评论 0原文

我正在使用 Wix 3.5 Votive(视觉工作室集成)为某些 COM 对象编写安装程序。

在 Votive 中,设置项目引用会从该项目中提取二进制文件,并在编译时自动生成 Wix 源。这绝对很棒,它是 DRY,意味着我不必不断更新 Wix XML。 Votive 生成​​的片段如下所示:

<Fragment>
    <DirectoryRef Id="INSTALLLOCATION">
        <Component Id="cmpBCE83EAB1AAF2230E306A7325EE7EA11" Guid="*">
            <File Id="fil61D40E7D1A1D0A60C27CE6960FED2B0B" Source="$(var.My.Assembly.TargetDir)\My.Assembly.dll" />
        </Component>
    </DirectoryRef>
</Fragment>

它对源文件、文档和卫星执行相同的操作,但我没有使用这些文件。然而,它没有做的是生成用于 COM 注册的注册表实体(程序集被标记为“COM Visible”和“Register for COM Interop”,但 Votive 似乎没有处理该问题的机制

。场景中,Votive 正在调用 Heat.exe 来收集所有这些内容,并在程序集上调用 Heat 并生成一个包含一堆 <; 的文件。 RegistryValue .../> 条目,这正是进行 COM 注册所需的内容,因此,Heat 可以生成这些内容,并且只需执行一次即可将输出编辑到 Wix 项目中。但是,这违反了 DRY 原则,并且需要手动使 Wix 项目与源代码保持一致,因为有些无关紧要的原因,我更希望在每次构建解决方案时让 Votive/MSBuild 自动执行此操作

。无论如何,我都不是 MSBuild 专家,而且我正在经历 Wix、Votive 和 MSBuild 的巨大学习曲线,到目前为止我花了几天时间。所以,我的问题是:是否有一种简单的方法可以让 Votive/MSBuild 在每次构建解决方案时生成此 COM 注册内容?我预计对于每个引用的项目,如果设置了“注册 COM 互操作”选项,那么 Votive/MSBuild 将为该项目的输出程序集生成 COM 注册内容。有没有人做到了这一点,如果是的话,在我的大脑变成果冻之前,请你帮我一把!

I'm using the Wix 3.5 Votive (visual studio integration) to author an installer for some COM objects.

In Votive, setting a project reference pulls in the binaries from that project and automatically generates the Wix source at compile time. This is absolutely great, it is DRY and means I don't have to constantly update the Wix XML. The fragment that Votive generates looks like this:

<Fragment>
    <DirectoryRef Id="INSTALLLOCATION">
        <Component Id="cmpBCE83EAB1AAF2230E306A7325EE7EA11" Guid="*">
            <File Id="fil61D40E7D1A1D0A60C27CE6960FED2B0B" Source="$(var.My.Assembly.TargetDir)\My.Assembly.dll" />
        </Component>
    </DirectoryRef>
</Fragment>

It does the same for the source files, documents and satellites, none of which I am using. However, what it doesn't do is generate the registry enties for COM registration (the assembly is marked as 'COM Visible' and 'Register for COM Interop' but Votive doesn't seem to have a mechanism to deal with that.

Behind the scenes, Votive is calling Heat.exe to harvest all this stuff, and invoking Heat on the assembly spits out a file with a bunch of <Class .../> and <RegistryValue .../> entries, which is exactly what's needed to do the COM registration. So sure enough, Heat can generate this stuff and it would be simple to do this once and edit the output into the Wix project. But, that violates the DRY principle and requires keeping the Wix project in step with the source code manually. For reasons that are somewhat tangential, I would prefer to have Votive/MSBuild do this automatically, each time the solution is built.

I'm not an MSBuild expert by any means, and I'm on a massive learning curve with Wix, Votive and MSBuild. It's taken me several days to get thus far. So, my question is this: Is there a straightforward way to have Votive/MSBuild generate this COM registration stuff each time the solution is built? I'd anticipate that for each referenced project, if the 'Register for COM Interop' option is set, then Votive/MSBuild would generate COM registration stuff for that project's output assembly. Has anyone accomplished that and, if so, can you give me a helping hand please, before my brain turns to jelly!

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

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

发布评论

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

评论(2

痴梦一场 2024-10-05 04:07:25

我不认为应该这样做,因为它会影响我喜欢在安装程序中看到的更改控制/确定性行为。我想知道安装中的每个文件/资源​​都已明确放入安装程序中,并且它不会神奇地漂浮在其中。我想明确地收集和创作我的 COM 元数据,以便我知道它是正确的。当您执行“构建时提取 COM”(InstallShield 术语)时,该过程可能会因多种原因而失败,然后您最终会得到一个看似良好的构建,但安装错误,无法正确部署。您可以引用 DRY 原则,但在此域中,规则的应用略有不同。

I don't believe any of this should be done as it takes away from the change control / deterministic behavior that I like to see in my installers. I want to know every single file / resource in the install was explicitly put into the installer and that it doesn't float in by magic. I want to explicitly harvest and author my COM metadata so that I know it's right. When you do "COM Extract at Build" ( InstallShield terminology ) the process can fail for any number of reasons and then you end up with a seemingly good build with a bad install that won't deploy properly. You can quote the DRY prinicipal but over in this domain the rules apply a little differently.

绝影如岚 2024-10-05 04:07:25

似乎从 Wix 3.0(至少)开始,如果在网络驱动器上编译该库,则无法生成 COM 互操作元素。我在使用 .NET 2.0 或 .NET 4.0 进行编译时发现了相同的行为。切换回构建本地驱动器(例如,C:),对于 .NET 2.0 和 .NET 4.0 程序集,此问题就会消失。

除了确保它位于本地驱动器上之外,我还没有找到一个好的解决方法。 :(

It seems that as of Wix 3.0 (at least), it is unable to generate the COM interop elements if the library is compiled on a network drive. I've discovered the same behavior when compiling with .NET 2.0, or .NET 4.0. Switching back to building off a local drive (eg, C: ) this problem goes away for .NET 2.0 and .NET 4.0 assemblies.

I've yet to find a good workaround other than making sure it's on a local drive. :(

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