none
Error on deployment of solution: Cannot add the specified assembly to the global assembly cache

    Question

  • Hi

    I have a solution that contains many different assmeblies, usercontrol, features etc.

    I have had no problems using this solution on a development server with the solution deployed to many different web application. I have been able to deploy/upgrade/retract it without error's.

    Now on a new production server I constantly run in to problems with a single assembly, and it's the same assembly that fails to either be added or removed every time.

    Cannot add the specified assembly to the global assembly cache: {assembly}

    And that's the only message I get, nothing to indicate what is wrong with it.

    I have tried restarting the timer servive, iisreset etc. but nothing helps, it just dies on every remove/deploy/upgrade etc.

    Is there some rules about how a solution can be deployed to different site collections? There are features in it that target web applications but they are not in the assmbly that fails GAC deployment.

    Also after a full restart of the enire server, I am able to remove the solution and add it again. I am also able to add and deploy the solution to a Web Application without errors. I guess that some service has a hold on that specific assembly. I can't unistall it manually from C:\windows\assembly when the error has occurred.

    Why is this happening? I so hop you can help me :)

    --
    Christian

    UPDATE:

    After a failed -o upgradesolution I get errors on the sites that use that specific assembly that it cannot find the file specified, but if I manually look int the GAC I see the assembly just fine..
    • Edited by Mike Walsh FIN Thursday, December 03, 2009 8:49 AM Don't use the word Error in a Title. Put " " around the error message. Also re-ordered.
    • Edited by Christian Sparre Thursday, December 03, 2009 8:51 AM update
    Thursday, December 03, 2009 8:48 AM

Answers

  • I'm not sure how that would keep the assembly from beeing added or removed when it sometimes works fine.

    I have disabled UAC on the server and it seems to have helped, though I haven't upgraded solutions as much the last days so I can't say for sure.
    Thursday, December 10, 2009 5:59 AM

All replies

  • Hi.

    Some thoughts.

    Is this assembly dependent on other assemblies/DLLs/Com objects (that you don't have on Prod)?
    Is your Prod 64bit?

    Regards,
    Magnus
    My blog: InsomniacGeek.com
    Thursday, December 03, 2009 9:36 AM
  • Thank you for the fast reply :)

    No, it's the same solution on both dev and prod machine, so I don't think there is anythin missin on prod.

    The dev is svr 2008 x64 and the prod is svr 2008 r2 x64

    Also I just remembered that the dev is WSS 3.0 SP1 and the prod is actually MOSS 2007 SP2, but I don't really think that is the problem. Nothing in the solution specifically targets WSS 3.0 stuff and as MOSS is build ontop WSS everything works fine when the solution is finally deployed.

    Any further ideas?

    --
    Christian
    Thursday, December 03, 2009 10:17 AM
  • Christian,

    what happens when you try to install it manually into the GAC (gacutil.exe /i [AssemblyName])?
    Thursday, December 03, 2009 11:56 AM
  • Hi Markus

    If the error has occurred nothing can touch that assembly, I need to restart the entire server before it gives up it's hold ;) Or so it seems, I will try some different aproaches..

    --
    Christian

    Thursday, December 03, 2009 3:12 PM
  • Maybe there s some problem in the code in one of the assemblies...

    Saturday, December 05, 2009 8:59 AM
  • I'm not sure how that would keep the assembly from beeing added or removed when it sometimes works fine.

    I have disabled UAC on the server and it seems to have helped, though I haven't upgraded solutions as much the last days so I can't say for sure.
    Thursday, December 10, 2009 5:59 AM
  • I know this is an old post, but I thought I'd share my solution.  I had the same thing happening.  I was about to reboot the server and decided I'd try an IISReset first (even though visual studio told me it was doing it).  After the iisreset, I re-deployed and it worked without any trouble.
    --Paul Galvin, BrightStarr
      Microsoft MVP - SharePoint
      Blogging @ http://www.mstechblogs.com/paul
      Twitter @ http://www.twitter.com/pagalvin
    Wednesday, September 28, 2011 5:34 PM
  • use

    gacutil -l yourassemblyname

    to list your assembly, and

    gacutil -u yourassemblyname

    to remove your assembly from gac, if you failed to remove, you need to solve the removing issue first.

    Wednesday, May 14, 2014 7:26 AM
    Moderator