Unable to register assemblies in GAC

Jul 15, 2013 at 3:12 PM
Hi,

I'm trying to install the assemblies in the GAC, but it doesn't register. I have also tried converting it to strongly typed, but it still doesn't show up in C:\windows\assembly

These are the things I tried:

1) Register the out-of-the-box assembly using powershell:
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") > $null
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\tmp\Microsoft.ResourceManagement.Client")

Result: In ServerManager, I get
Installation in the global assembly cache failed: C:\tmp\Microsoft.ResourceManagement.Client.dll

Next, I tried opening a visual studio command prompt and converting the assemblies to strongly typed by following the instructions here:
http://codeingaddiction.blogspot.co.uk/2011/06/how-to-add-strong-name-to-existing-dll_16.html

I installed it using Gacutil, but that only installed the file under C:\windows\microsoft.NET but not under C:\windows\assembly (which is where I need it). I tried registering this using the above powershell method as well, but got the same failure message

Any suggestions on how should I register this assembly? I'm running Windows Server 2008 R2 with .NET 4.0

Thanks
Coordinator
Jul 31, 2013 at 7:12 AM
Hi,

Sorry for the late answer, I was on holidays :)
I hope you solved it in the meanwhile, but your problem is due to the fact that .NET framework 4 uses a different GAC than 3.5
With PowerShell and Gacutil you installed the assembly in the GAC used by .NET 4. This depends on the PowerShell or Visual Studio tools version you are using.
If you need to install the assembly in the 3.5 GAC, you can simply drag and drop the dll to C:\windows\assembly.

Cheers,
Paolo
Jul 31, 2013 at 9:16 AM
Hi Paolo,

Thanks for your reply.

I have used the same PS method earlier as well and the assemblies do get GAC'd into C:\windows\assembly. Drag and drop doesn't work for me unfortunately, some security issues around that (I tried everything, even opening explorer as an admin, disabling UAC etc).

For now, I'm not GAC'ing the assemblies, instead I've copied them directly into the bin folder of the sharepoint site and I'm using them from there. I'm not sure if I'm supposed to convert the assemblies to strongly named manually 'cos that doesn't quite feel right.

Cheers
Coordinator
Jul 31, 2013 at 9:28 AM
Why don't you just add a key file to the project and use it to sign the assembly when you build?
http://msdn.microsoft.com/en-us/library/ms247123(v=vs.100).aspx

Cheers