I've been getting this error a lot lately and I don't know why. The logs are frustratingly unhelpful with only two lines:
Solution Deployment : Error Global Deployment failed for CustomSolution.Common.wsp. Exception - Error: Cannot add the specified assembly to the global assembly cache: CustomSolution.Common.dll.
Solution Deployment : Error : DeploySolutionPackage for CustomSolution.Common.wsp for Target global. Exception message - Error: Cannot add the specified assembly to the global assembly cache: CustomSolution.Common.dll.
The event logs say nothing as far as I can find at least. I'm using Add-SPSolution and Install-SPSolution to deploy the wsp.
I have tried:
- looking for processes that use the DLL using Process Explorer and stopping them.
- Rebooting my environment.
- removing all traces of the dll from both C:\windows\Microsoft.NET\assembly\GAC_MSIL and C:\windows\assembly\temp
- recycling SPTimerV4, SPAdminV4, IIS, AppFabricCachingService and SPSearchHostController
- reflecting into the SharePoint dlls to see what exactly it does and try to figure out when the exception is thrown (turns out it uses Fusion Install which is a native dll to Windows to GAC dlls).
- using FUSLOGVW.exe to check for log entries during deploy, but it only seems to log on assembly binding and not GACing.
I thought it might be due to some references in my assembly, but I'm only referencing standard SharePoint stuff and one other utility library that is already GACed just fine. The thing is it works "sometimes" and for the life of me I can't figure out why.
Edit: Some additional information:
- Target framework .NET 4.5
- Both the projects are plain empty SharePoint 2013 projects.
Anyone have any tips on what could be wrong or where I could perhaps find any more info?
Thanks to pholpar for providing a way to get additional diagnostics information! Using gacutil returned the following error:
Failure adding assembly to the cache: Strong name signature could not be verified. Was the assembly built delay-signed?
I do not remember changing the assembly recently and as far as I know I'm not building it "delay-signed", but after recreating the key for my project I was able to deploy it normally.