我是否需要注册 COM dll 才能在 .NET 项目上引用它?

发布于 2024-08-13 16:08:38 字数 237 浏览 4 评论 0原文

我试图通过使用“浏览”选项卡并选择 DLL 来引用 Visual Studio 中的 COM DLL。我注意到,如果 DLL 已使用 regsvr32 在系统上注册,我可以引用它,但如果未注册,我在选择 dll 文件时会收到错误“无法添加对‘file.DLL’的引用。请确保文件可访问,并且它是有效的程序集或 COM 组件。”
我们希望保持 DLL 不注册,以便我们在其他开发机器和开发环境上需要更少的配置。
是不是要求太多了?
谢谢!

I'm trying to reference a COM dll in visual studio by using the Browse tab and selecting the DLL. I noticed that if the DLL is registered on the system with regsvr32 I can reference it, but if it's not registered I receive an error selecting the dll file "A reference to 'file.DLL' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component."
We would like to keep the DLL not registered, so that we have less configuration needed on other development machines and on the development environments.
Is it too much to ask?
Thanks!

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

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

发布评论

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

评论(4

沉鱼一梦 2024-08-20 16:08:38

你需要注册dll。您可以在安装项目中设置注册或为所有这些类型的进程创建批处理文件。
注意:卸载时不要忘记取消注册 dll。

you need to register dll. you can set registration in your setup project or create a batch file for all these type of processes.
Note: Don't forget to unregister dll on uninstallation.

再浓的妆也掩不了殇 2024-08-20 16:08:38

您需要注册 dll,否则它将无法找到类型库。
随后添加 dll 作为对项目的引用将创建 interop.XXXXmethod.dll 程序集。

You'll need to register the dll because otherwise it would not be able to find the type library.
Adding the dll afterwards as a reference to you project will create the interop.XXXXmethod.dll assembly.

奢华的一滴泪 2024-08-20 16:08:38

您需要注册 COM 服务器,就这样。您可以采取一些措施来自动化该过程,并在不需要时取消注册 COM 服务器。

这同样适用于日常构建。如果您在构建期间构建 COM 服务器和基于 .NET 的客户端,则必须在构建客户端之前注册服务器。并且您最好在客户端构建后立即取消注册。将这些步骤添加到构建序列中根本不是问题。

You need to have the COM server registered, period. You could take some measures to automate the process though and to unregister the COM server when it is not needed.

The same applies to daily builds. If you build a COM server and a .NET based client during the build you have to register the server prior to building the client. And you better unregister it as soon as the client is built. Adding these steps to the build sequence is not a problem at all.

失与倦" 2024-08-20 16:08:38

您或许可以使用免费注册网站

You might be able to use Registration Free Com

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