使用WiX生成和安装Typelib [英] Typelib Generation and Installation with WiX

查看:78
本文介绍了使用WiX生成和安装Typelib的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

>询问Visual Studio为注册COM所做的工作之后库,很明显,VS为COM注册做了两件事:

After asking about what Visual Studio does to register a COM Library, it became clear that VS did two things for COM registration:

  1. 注册COM库
  2. 创建并注册类型库

Visual Studio似乎使用regasm.exe进行了此注册.对于第一部分(直接COM注册),使用tallowheat(WiX 2.0或WiX 3.0)似乎可以正确地获取所有基本的COM注册信息.

Visual Studio seems to do this registration using regasm.exe. For the first part (the direct COM registration) using tallow or heat (WiX 2.0 or WiX 3.0) seems to get all of the basic COM registration information correct.

但是,牛脂/热似乎不起作用的是设置类型库安装.可以使用WiX安装程序和regasm.exe创建自定义操作来执行此操作,但是对于基于Microsoft安装程序的安装程序,调用自定义操作并不是最佳实践.

However, what tallow/heat doesn't seem to do is set up a type library installation. It would be possible to create a custom action to do this with a WiX installer and regasm.exe, but invoking custom actions are not best practices when it comes to Microsoft installer based installers.

根据进一步的研究,看起来msi能够在安装时生成类型库.实际上,WiX似乎对此有直接支持!在文件元素中,您可以添加 Typelib 元素.实际上,关于wix的文章中有一个示例使用 Interface 元素填充TypeLib元素的方法.

Upon further research, it looks like an msi has the ability to generate the type library upon installation. In fact, WiX seems to have direct support for it! In a file element, you can add a Typelib element. In fact, an article over here on wix has an example of filling out the TypeLib element with Interface elements.

似乎接口元素至少有两个必需的属性:

It seems there's at least two required attributes to an Interface element:

  1. 编号
  2. 名称

拉里·奥斯特曼(Larry Osterman)谈到了界面的其他部分,通常需要为TypeLib注册,并且该Interface条目似乎照顾了各个部分.拉里说,我们需要将ProxyStubClassId32指定为"{00020424-0000-0000-C000-000000000046}",因此我们可以轻松地添加它.

Larry Osterman speaks about the other parts of the interface that need to be registered for a TypeLib in general, and this Interface entry seems to take care of the individual parts. Larry says we need to specify the ProxyStubClassId32 as "{00020424-0000-0000-C000-000000000046}", so we can easily add that.

从那里去哪里以及为各种Interface元素填写什么内容让我感到困惑.我已经将TypeLib元素添加到我的wix文件中,并且可以成功编译.不过,我对如何设置接口元素一无所知.要正确填写TypeLib元素,我们需要做些什么?我可以使用哪些应用程序或工具来获取它?

Where to go from there and what to fill out for the various Interface elements has me stumped. I've gone ahead and added the TypeLib element to my wix file, and it successfully compiles. I'm a bit clueless as to how to set up the Interface elements though. What do we need to do to properly fill out the TypeLib element, and what apps or tools can I use to get it?

wcoenen在下面的回答看起来很有希望...我会试一试.

The answer below by wcoenen looks promising...I'm going to give it a shot.

更新:将我的最终解决方案发布在下面作为答案.

Update: Posted my final solution below as an answer.

推荐答案

这是解决这个问题的懒人方法:使用WiX 3.0中的heat.

Here's the lazy man's way of solving this problem: Use heat from WiX 3.0.

如果您具有自动生成并通过regasm安装的类型库,则heat可以将.tlb作为参数,

If you have a type library generated automatically and installed via regasm, heat can take the .tlb as an argument in

heat file c:\my\path\to\my.tlb -out tlb.wxs

它将生成您需要注册的所有typelib和接口元素.这不会解决需要提前知道它们的问题,也不会解决在程序集的版本更改时GUID更改的问题(即使接口没有更改-这是您唯一的时间)我们应该对其进行更改),但是它将带您一路走来.

It will generate all the typelib and interface elements you need to register. This won't solve the problem of needing to know them ahead of time, and it won't solve the problem of GUIDs changing when the version of the assembly changes (even if the interface doesn't - which is the only time you're supposed to change it) but it will get you partway there.

这篇关于使用WiX生成和安装Typelib的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆