Ever since upgrading to Visual Studio 2013 (From 2012), I've noticed that while debugging my ASP.NET MVC 5 app, I'll occasionally get a compiler error dump through IIS Express of:
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS0042: Unexpected error creating debug information file 'c:\Users\Jeff\AppData\Local\Temp\Temporary ASP.NET Files\root\368a9040\83fb9039\App_global.asax.PDB' -- 'c:\Users\Jeff\AppData\Local\Temp\Temporary ASP.NET Files\root\368a9040\83fb9039\App_global.asax.pdb: The process cannot access the file because it is being used by another process.
Source Error:
[No relevant source lines]
Source File: Line: 0
This error goes away if I open up Process Explorer and then search for the handle to App_global.asax.pdb (that DevEnv.exe has) and forcefully close it and then refresh the page. However, that's inconvenient and I've never had to do that before 2013.
Anyone have an idea on why this is happening intermittently on 2013 but not before?
The only possible thing I could think of was some obscure issue with Razor Generator's MSBuild step that I use, but I couldn't figure why it'd be on the App_Global.asax and not a view (and even then, it shouldn't be compiling for an unmodified view)
After upgrading to VS2013 we ran into this issue on a large webforms application that we develop. We solved it be removing the optimizeCompilations="true" attribute from on the compilation element in our Web.Config file.
I also tried VS2013 Update 1 and VS2013 Update 2 RC and neither of them resolve this issue.