使用 Visual Studio 安装项目自动注册和 GAC COM Interop DLL

发布于 2024-09-07 03:30:22 字数 829 浏览 3 评论 0原文

我已经为 COM 互操作创建了一个 .NET 程序集,它在我的开发计算机上运行良好。我目前正在尝试弄清楚如何使用 Visual Studio 的“安装项目”将 DLL 部署到目标计算机。如何使用 VIsual Studio 安装项目执行以下操作:

  • 注册程序集(当前使用 regasm)。
    • 程序集需要成功注册并且类型库(.tlb)需要成功注册
    • 这个答案建议放弃regasm,转而使用自定义代码。我这是个好主意吗?如果是这样,该代码如何包含在安装项目中?
    • 此答案建议使用regasm/regfile 命令,然后使用安装项目中注册表上的导入工具。这行得通吗?
  • 在 GAC 中安装程序集(当前使用 gacutil
    • 我知道“目标计算机上的文件系统”中存在“全局程序集缓存文件夹”。将程序集包含在设置项目中需要做什么特别的事情吗?

任何其他建议或疑虑将不胜感激。

I've created a .NET assembly for COM interop and it is working well on my development machine. I'm currently trying to figure out how to deploy the DLL to a target machine using Visual Studio's "Setup Project." How can I use the VIsual Studio setup project to do the following things:

  • Register the assembly (currently using regasm).
    • The assembly needs to be registered successfully and the type library (.tlb) needs to be registered successfully.
    • This answer suggests scrapping regasm in favor of custom code. I this is a good idea? If so, how does this code get included in the setup project?
    • This answer suggests using the /regfile command of regasm and then using the import tool on the Registry in the Setup Project. Will this work?
  • Install the assembly in the GAC (currently using gacutil)
    • I'm aware of the "Global Assembly Cache Folder" in the "File System on Target Machine." Is there anything special I need to do in including the assembly in the setup project?

Any other advice or concerns would be much appreciated.

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

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

发布评论

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

评论(1

老子叫无熙 2024-09-14 03:30:22

Gacutil.exe 在目标计算机上不可用。没问题,MSI 可以完成这项工作。右键单击“目标计算机上的文件系统”,添加,GAC。右键单击添加的文件夹,“添加”,“项目输出”。这确保了程序集是经过 gac 处理的。

它还可以像 Regasm.exe 一样注册程序集。将项目输出引用的 Register 属性设置为 vsdrpCOM。

Gacutil.exe won't be available on the target machine. Not a problem, MSI can get the job done. Right-click "File System on Target Machine", Add, GAC. Right-click that added folder, Add, Project Output. That ensures the assembly is gac-ed.

It can also register the assembly like Regasm.exe does. Set the Register property of the project output reference to vsdrpCOM.

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