7

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?

Edit:

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.

  • 1
    Do you have the .NET version the assembly was built against? Can you install the assembly into GAC manually (via gacutil)? Can you deploy the WSP on other SharePoint farms / install the assembly into GAC on other PCs? – pholpar Mar 20 '15 at 13:35
  • did you check the gac folder if Dll is already their? also did you try force parameter? reset IIS.check this social.msdn.microsoft.com/Forums/sharepoint/en-US/… – Waqas Sarwar MVP Mar 20 '15 at 14:44
  • @Waqas Sarwar MCSE I did reset IIS (see point 4). The dll is not present in the GAC_MSIL folder nor assembly or assembly\temp (see point 3). I've tried both with and without -Force – Thomas Mar 23 '15 at 6:40
  • @pholpar Thanks! Using GACUtil I was able to get some more information and it deploys fine now. Will definitely be using that tool more in the future. Not sure how to best resolve this question though and still give you the credit you deserve. If you write it up as a proper answer I'll mark it as resolved :) – Thomas Mar 23 '15 at 6:55
5

I suggest you to try the GACUtil tool to try to deploy your assembly, just to test if it is deployable to the GAC at all. If the deployment still fails, this tool might provide you additional information about the reason of the error, that you can use to resolve the issue itself.

  • 3
    To future archaeologists coming across this question. The problem was resolved by using GACUtil and uncovering that my project keyfile was somehow corrupt. Recreating the keyfile solved the issue. – Thomas Nov 22 '16 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.