Today I was deploying a solution to a web application and got the error message The process cannot access the file ‘MySolutionsName.dll’ because it is being used by another process.”
After first giving the normal “What the What?” I checked the solution store and noticed the solution was in Error, and had the same error message listed. Looked like there was some issues with the solution file earlier during the day, either someone deploying it or retracting or maybe both. So after scratching my head and deciding that Uninstalling SharePoint wasn’t going to be a good option (just kidding btw), a quick google pointed me to an article below. Referencing a similar issue and giving a quick step on how to figure ou what process is holding your DLL hostage. So I followed the steps; opened up a command prompt and typing in tasklist /M mysolutionheldhostage.dll(replacing the dll name with the name of my DLL). and it returned a list that a powershell process had a hold of my dll. So I opened up task manager, and sure enough a developer was doing something or the other to my dll in powershell. Next steps you could do would be KILLING THE PROCESS, or you could take a much gentler approach like contacting the offending user and asking them if they could close the app. WARNING, “Killing a task by force through the task list is probably not the best idea as it could cause undesired results.” You’ve been warned.
Anyways the developer was done, I killed the powershell process and was able to deploy the solution agian. Post below with a subsequent blog post following.