I had this problem with Visual Studio 2008, 2010 and 2013. I wrote a batch file that I store in the solution folder for each of my projects when this problem occurs. Turning around what Vijay said, this clears the bin and obj folders. Sometimes folders will be locked in Visual Studio, and I have to close them, but after I clean them, the problem will disappear ... for a while. I am not sure about the main reason, I believe that binary files and code in memory somehow go out of sync. But this allows you to quickly close, clean, open the solution.
@echo off cls dir bin /s /AD /b > clean.tmp dir obj /s /AD /b >> clean.tmp for /F "tokens=*" %%A in (clean.tmp) do echo rmdir /S /Q "%%A" echo This command will remove ALL BIN and OBJ folders in this tree. echo To run the commands as listed ... pause for /F "tokens=*" %%A in (clean.tmp) do rmdir /S /Q "%%A" del clean.tmp pause
Billy willoughby
source share