For one of my ASP.NET 3.5 applications, every single time I try to build the web app, it throws the following build errors in Visual Studio 2008:
Error 16
I had this issue on a web project with System.Web.Extensions.dll from the Microsoft Reference Assemblies folder. Setting "Copy Local" to false in the reference properties fixed it.
You could download the excellent SysInternals Handle program. This will tell you which processes have a lock on the files concerned.
If it is an external program (e.g. virus scanner/indexer) then this should help. If it just reports Visual Studio (devenv.exe) as the culprit, then it will be of less help!
Check if the user dll and the application referencing the dll target the same .NET framework. I had a case where the frameworks were different which caused this problem.
Just go to \Debug\bin and delete all .dll files.
Working great for me.
Delete the binaries from the bin\Debug folder and recompile them. This works for me!!!
I didn't have any luck with the pre-build events unfortunately. What worked, in typical IT Crowd fashion, was to quit Visual Studio and reopen it.