开发者

Installing Assembly into GAC

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开发者_如何学JAVA help me


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\

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

UPDATE: Signing Assembly

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.

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜