Installing Assembly into GAC

后端 未结 1 1521
野性不改
野性不改 2021-01-18 00:53

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

1条回答
  •  隐瞒了意图╮
    2021-01-18 01:14

    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 讨论(0)
提交回复
热议问题