COM注册和GAC [英] COM Registration and the GAC

查看:74
本文介绍了COM注册和GAC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Visual Studio 2005中,我有一个Web项目,一个C#库项目和一个Web安装项目。该Web项目需要C#库需要在GAC中注册。这很简单,只需将GAC文件夹添加到设置项目中,然后将C#库的主要输出放到那里。还需要为COM互操作注册C#库。我单击选择GAC文件夹中的主要输出,然后将Register属性更改为vsdrpCOM。我建立了安装项目并运行它,但是DLL从未为COM注册。

I have a web project, a C# library project, and a web setup project in Visual Studio 2005. The web project needs the C# library needs to be registered in the GAC. This is simple, just add the GAC folder to the setup project and drop the primary output of the C# library in there. The C# library also needs to be registered for COM interop. I click select the primary output in the GAC folder and change the Register property to vsdrpCOM. I build the setup project and run it but the DLL never gets registered for COM.

这对我来说真的不是一个惊喜。我一直必须添加一个安装程序类,该类具有一个自定义操作,该操作使用RegistrationServices.RegisterAssembly为COM正确注册我的DLL。因此,我将我已经接受多年的这种解决方法应用于我的情况。现在,我发现在安装程序项目的GAC文件夹中分配给主要输出的自定义操作会阻止安装程序项目的均匀构建。

This is not really a surprise to me. I have always had to add an installer class which had a custom action which used RegistrationServices.RegisterAssembly to properly register my DLLs for COM. So I apply this workaround which I have accepted for years to my situation. Now I find that custom actions assigned to primary output in the GAC folder of a setup project prevent the setup project from even building.

我一直觉得自己是在窃取Thigs使.NET和COM与设置和部署项目配合使用。解决我的问题的正确方法是什么?

I have always felt like I was hacking thigs to get .NET and COM to play nice with setup and deployment projects. What is the proper way to solve my problem?

推荐答案

要在COM中注册程序集,请使用:regasm / codebase。请参阅: http://msdn.microsoft.com/en -us / library / tzat5yw6(VS.80).aspx 了解详情。对我来说,您安装到GAC中的方法似乎不错。

To register the assemblies with COM use: regasm /codebase. See: http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx for details. Your method for installing into the GAC seems fine to me.

这篇关于COM注册和GAC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆