I am using Visual Studio 2005. After taking code from version control first, the c#.net application runs correctly. But, after doing some modifications, when I build I am
I stepped into this problem too.
First go and check if you have mapped your bin and obj folder to the Source Control program.
This may be turning your files from binaries folders into read only archives, which make impossible to visual studio to overwrite them when it compiles the code.
Go and remove the mapping from these folders, check the changes and try again.
My problem occurred using TFS(Team foundation server) and Visual Studio 2010.
Hope this helps someone.