I've been battling for two days tracking down a mysterious error when compiling an ASP.NET website. The error is the (quite famous) CS0016: "Unable to write to output file [filename] - directory is invalid".
I have discovered after two days of debugging that the cause of my problem is that the NetworkService somehow does not have the necessary rights to C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files. I have added "Everyone" with full rights to the folder - but I am still unable to access
You need to grant the NetworkService right permission to your system temp directory (the directory in the Temp variable). This is because the temporary asp.net files gets written to this temporary folder first before being moved to the ASP.NET Temporary Internet Files directory.