Yesterday I was not able to deploy my solution to my sharepoint development server, with the error message
Error occurred in deployment step ‘Add Solution’: Error: Cannot add the specified assembly to the global assembly cache: MyLibrary.dll.
As the error message did not tell me why this happened or how I could fix it, I asked google. I found a lot of suggestions regarding permissions which were not relevant in my case. It turned out to be an easy fix however:
Manually uninstall the dll from the GAC!
In details: Start, run, %windir%\assembly\, find your dll, right click and choose uninstall.
In my case, I was not allowed to uninstall it because it was in use, so with some help from the process explorer from Sysinternals I found (click Ctrl+F and search) that owstimer, web analytics service and four instances of visual studio (devenv) were all using my dll. Restarting the services and closing my visual studio sessions allowed me to uninstall the dll from the GAC, and deployment worked fine again after that.

You don’t need Process Explorer, the following command line command will also do the work:
PS C:\Users\bratuk> tasklist /M MySuperfancy.dll
Restarting VS and stopping owstimer will probably fix most of these issues i guess.
Hi Brage, thanks for the tip! I’ll try that next time I run into this
Øystein
Hi,
I had this problem also and process explorer helped me. TaskList was not showing ReportingServicesService that also had a lock on the DLL.
Radu
Thanks! uninstalling manually from gac helped me (had to do a iisreset to unlock the file first)
Try doing an IISreset , clear your Temporary Files Folder and if that still doesnt work, close your VS and restart your VS.It did work for me. Thank you.Simi