Today I opened up a branch of code in TFS for the first time in a week to find this error.
This is an error i have seen in the past. From what i can understand the old .dll file is being used by some unknown process. SharePoint sometimes gets “stuck” on different files, and this is one of them. Since some process has the file opened Visual Studio cannot overwrite it, and the error is a result. Here is how I fixed the issue.
- Open up a windows explorer and navigate to C:\windows\assemblies.
- Find the ProjectName.dll file which is causing the error and delete this from the folder.
- Restart the machine.
- Rebuild the project and deploy.
This time I got a second error after I fixed the .dll error:
An error occurred in deployment step ‘Retract Solution’: The language-neutral solution package was not found
This error was new to me, so I did a quick search online and found this article: http://pankajspoint.blogspot.com/2011/01/error-occurred-in-deployment-step.html
The solution is to open up SharePoint Management shell and run the command “(get-spsolution mysolution.wsp).Delete()”. This should take care of the error and you should be able to redeploy it.