使用 WiX 在 GAC 中注册 COM dll

发布于 2024-10-05 22:32:45 字数 548 浏览 1 评论 0原文

大家好,

我正在为我的程序编写 WiX 安装脚本。我需要将 C# dll 安装到 GAC,然后注册它。因此,我用 Assembly=".net" 标记该文件,以便 WiX GAC 为我处理它,然后我有一个延迟的自定义操作,设置为在 InstallFinalize 之前运行,它调用 Assembly.Load 从 GAC 加载程序集,然后调用 RegistrationServices.RegisterAssembly 来注册它。

应该是完美的,除了一个问题:显然,直到提交阶段,dll 才真正写入 GAC,因此当我的自定义操作运行时,Assembly.Load 会抛出异常,因为它找不到文件。它在哪里?在提交阶段之前是否可以访问?或者有更好的方法来完全做到这一点吗?看起来是一件微不足道的事情...

请不要建议使用 heat.exe;我真的很想避免它。我的程序有一个 ComRegisterFunction,如果可能的话,它希望在用户的计算机上执行。

Greetings all,

I'm working on a WiX installation script for my program. I need to install a C# dll to the GAC and then register it. So, I mark the file with Assembly=".net" so that WiX GACs it for me, and then I have a deferred custom action, set to run before InstallFinalize, which calls Assembly.Load to load the assembly from the GAC and then RegistrationServices.RegisterAssembly to register it.

Should be perfect, except for one problem: Apparently the dll isn't actually written to the GAC until the commit phase, so when my custom action runs, Assembly.Load throws because it can't find the file. Where is it? Is it at all accessible before the commit phase? Or is there a better way to do this entirely? Seems like such a trivial thing...

Please do not suggest using heat.exe; I'd really like to avoid it. My program has a ComRegisterFunction that would like to execute on the user's computer if at all possible.

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

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

发布评论

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

评论(1

月竹挽风 2024-10-12 22:32:45

通常,在安装过程中,自我注册是不受欢迎的,正是因为像您所描述的那样的问题。您应该将注册表项添加到 WiX 脚本中。

另外,您不仅仅将程序集安装在 GAC 中,是吗?将您的 COM 注册指向非 GAC 位置。

Self-registration in general is frowned upon during installation, exactly because of problems like the one you described. You should add the registry entries to the WiX script instead.

Also, you are not installing your assembly in the GAC only, are you? Point your COM registration to the non-GAC location.

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