Compiler Error Message: CS0016: Could not write to output file
This pain in the ass caused myself and a colleague a days worth of scratching arounf trying to resolve. We were both developing multi-project applciations within VS2003 (although I believe this affect VS2005 as well) and getting this error when trying to compile EXE’s. Web projects and DLLs were fine but we could not figure out what was wrong.
I looked at http://support.microsoft.com/?id=313512 and http://support.microsoft.com/default.aspx?scid=kb;en-us;825791 and even http://support.microsoft.com/?kbid=867770 but nothing really matched the problem that we were getting. It wasn’t until I came accross this post http://dotnetfish.blogspot.com/2008/01/compiler-error-message-cs0016-could-not.html that the answer was revealed.
A new AV policy had been applied to the machine that restricted write access to the TEMP folder. This was stopping Visual Studio from creating the EXE I was trying to compile as it uses the TEMP folder during the compilation process.