向 COM 注册托管程序集而不使用 GAC
我想知道是否可以向 COM 注册程序集,而不必向 GAC 注册。我们需要部署一些使用 CCW 向经典 asp 公开的 .net 库。但部署是一场噩梦。
I'm wondering if it possible to register assemblies with COM without having to register it with the GAC. We need to deploy some .net libraries that are exposed to classic asp using a CCW. But deployments are a nightmare.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,使用
regasm.exe
和/codebase
键即可。当您在没有/codebase
的情况下使用regasm.exe
时,它只会将程序集的文件名写入注册表,因此 .NET 运行时无法找到它,除非程序集位于GAC。使用/codebase
它将写入完整路径,并且当使用者调用CoCreateInstance()
时,.NET 将很乐意找到程序集。Yeap, use
regasm.exe
with/codebase
key for that. When you useregasm.exe
without/codebase
it only writes the filename of the assmebly to the registry and so the .NET runtime can't find it unless the assembly is in the GAC. With/codebase
it will write the full path and .NET will be happy to find the assembly when the consumer callsCoCreateInstance()
.是的,您可以在程序集上使用 Regasm,而无需将其添加到 GAC 中。例如,我将 ASP 和 ASP.NET 站点与 bin 文件夹中的 .NET 程序集混合在一起。有些暴露给 COM 并从 bin 文件夹中就地注册。
当然,这些程序集对于应用程序来说是唯一的,不会被其他应用程序共享。并不是说这也是不可能的,您可能会选择一个中立位置来将此类 dll 复制到其中。
Yes you can use Regasm on an assembly without it being in the GAC. For example I have mixed ASP and ASP.NET sites with .NET assemblies in the bin folder. Some are exposed to COM and are registered in situ from the bin folder.
Of course these assemblies are unique to the application and aren't shared by other apps. Not to say that isn't possible either, you would probably choose a neutral location to copy such dlls to.