如何在 WiX 3 中注册 Win32 COM DLL 文件? [英] How do you register a Win32 COM DLL file in WiX 3?

查看:25
本文介绍了如何在 WiX 3 中注册 Win32 COM DLL 文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我找到了一个关于注册 DLL 的示例,注册带有 Windows Installer XML 工具集的 MSI 文件中的 COM Interop 程序集.,而 WiX 抱怨AssemblyRegisterComInterop"属性.

I found an example on registering DLLs, Registering an Assembly for COM Interop in a MSI file with the Windows Installer XML toolset., and WiX complains about the "AssemblyRegisterComInterop" attribute.

我删除了它并将Assembly"属性更改为 win32,它说我需要指定 AssemblyManifest 属性,但我应该在那里放什么?

I removed that and changed the "Assembly" attribute to win32, and it says I need to specify the AssemblyManifest attribute, but what should I put there?

推荐答案

最简单的方法(Rob M 会大吼大叫这是错误)就是使用 SelfRegCost=1 在 DLL 的 File 标签上.

The easiest way (and Rob M will rant and rave about how this is wrong) is just to use SelfRegCost=1 on the File tag for the DLL.

这是错误的,因为我们应该明确控制 DLL 的注册,而不是让它通过 DllRegisterServer 运行任意代码.理论是当 DllRegisterServer 被调用时,DLL 除了在注册表中放置适当的条目之外什么都不应该做.不幸的是,他们中的很多人做的远不止这些,因此自行注册可能是让您的安装工作的唯一方法.

This is wrong, because we should be explicitly controlling the registration of the DLL, not allowing it just to run arbitrary code via DllRegisterServer. The theory being that a DLL should do nothing beyond putting the appropriate entries in the registry when DllRegisterServer is called. Unfortunately, a lot of of them do more than that, so self-registration might be the only way to get your install to work.

这也是错误的,因为这意味着 Windows 安装系统对这些注册表项一无所知,也不知道应该存在哪些不应该存在的内容.这意味着修复将不起作用,并且可能卸载无法正确清理等.

It's also wrong, because that means the Windows installation system doesn't know anything about those registry keys, and what should and shouldn't be there. That means repairing won't work, and possibly un-installation won't clean up properly, etc.

否则,您可以通过将 heat.exe 指向您的 DLL,并将其输出集成到您当前的 WiX 项目中来生成适当的 WiX 代码.您将获得各种 Class、ProgID、TypeLib 和 Registry 标记.您可能需要手动编辑该输出以使其编译.

Otherwise, you can generate the appropriate WiX code by pointing heat.exe at your DLL, and integrating its output into your current WiX project. You'll get a variety of Class, ProgID, TypeLib, and Registry tags. You may need to manually edit that output to get it to compile.

希望能帮到你.

这篇关于如何在 WiX 3 中注册 Win32 COM DLL 文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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