Three years ago I wrote the article PRB: ‘Could not copy temporary files to the output directory’ error building Visual Studio .NET add-in explaining the common cause for that error when running an add-in project.
There is a second cause that happens when you have a dead devenv.exe process, which can happen from time to time while debugging add-ins, interrupting abruptly the debugging session, entering the computer in sleep mode or something else that I can’t determine for sure, but the fact is that you end with two devenv.exe instances in memory, a visible one with your add-in project and a hidden one locking the DLL. Since this second one doesn’t have a visible window, you have to use the Processes tab of the Task Manager to see it. And of course, you want to kill it, but how do you know which devenv.exe process to kill? The Task Manager of Windows is not of much help, but you can use the much more powerful Process Explorer utility from the former SysInternals (now owned by Microsoft and provided through Microsoft TechNet):
With Process Explorer, which can replace the Task Manager when pressing Ctrl+Alt+Del and clicking the Task Manager button (Options, Replace Task Manager menu) you can right-click a devenv.exe process and select the “Bring to Front” menu. If the main IDE window brings to front, you know that the devenv.exe process is active. Otherwise, it is a dead one and you can kill it. Before using Process Explorer, I always had to choose randomly and I almost ended killing the wrong one.