使用 Visual Studio 安装项目自动注册和 GAC COM Interop DLL
我已经为 COM 互操作创建了一个 .NET 程序集,它在我的开发计算机上运行良好。我目前正在尝试弄清楚如何使用 Visual Studio 的“安装项目”将 DLL 部署到目标计算机。如何使用 VIsual Studio 安装项目执行以下操作:
- 注册程序集(当前使用
regasm
)。 - 在 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 ofregasm
and then using the import tool on the Registry in the Setup Project. Will this work?
- The assembly needs to be registered successfully
- 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
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.