安装部件为GAC [英] Installing Assembly into GAC

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

问题描述

我试图用GAC中安装程序集 新System.EnterpriseServices.Internal.Publish()GACInstall(Foo.dll); 但我无法找到安装在c:\ WINDOWS \组装\ GAC_MSIL文件夹。我没有收到SecurityException异常也是如此。谁能帮我

I tried to install an assembly in GAC using new System.EnterpriseServices.Internal.Publish().GACInstall("Foo.dll"); But I could not find that installed in c:\windows\assembly\gac_msil folder. I did not receive the securityexception as well. Can anyone help me

推荐答案

首先,确保它的签署。我想这是因为你没有得到任何的异常。 此外,如果它是一个.NET 4.0组件,它会在一个新的位置@%WINDIR%GACed \ Microsoft.NET \装配\

First of all, make sure it's signed. I assume it is since you didn't get any exceptions. Also, if it's a .net 4.0 assembly, it will be GACed at a new location @ %windir%\Microsoft.NET\assembly\

更多关于这个在这里: .NET 4.0中有一个新的GAC,为什么呢?

More on this here: .NET 4.0 has a new GAC, why?

更新:签约大会

右键点击组装项目,进入属性。在项目属性界面中选择签名选项卡。选中登录大会,并在选择强名称密钥文件选择新建。在这里你必须指定键值名,将打开一个对话框。我通常使用的解决方案的名称作为我的键名。您还可以使用密码保护密钥(您preference)。一旦您完成后,点击对话框上的OK,建立自己的项目。现在尝试GAC一遍。

Right click on the Assembly project and go to "Properties". On the "Project Properties" screen select "Signing" tab. Check "Sign the assembly" and in the "Choose strong name key file" select "new". That will open up a dialog where you have to specify the key name. I usually use solution name as my key name. You can also password protect the key (your preference). Once you're done, hit "OK" on the dialog and build your project. Now try to GAC it again.

快速的建议:如果你有你想GAC项目的多个组件,你可以分享,而不是生成一个新的每一个相同的密钥文件。我通常将我的密钥文件在同一个位置,我的解决方案文件坐着共享整个项目的解决方案。

Quick suggestion: If you have multiple assemblies in the project you'd like to GAC, you could share the same key file instead of generating a new one for each. I usually drop my key file in the same location where my Solution file sits and share it across projects in the solution.

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

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