Search code examples
visual-studio-2012vs-web-site-projectapp-code

How does Visual Studio process the App_Code folder specially?


How does Visual Studio process the App_Code folder when a change is made or detected in it? Not IIS or ASP.NET.

I want to gain a better understanding of why Visual Studio freezes for long periods of time whenever I save a code file inside a large App_Code folder of a website project. Alternatively, I could ask: why does Visual Studio not exhibit these same freezes when processing a file inside a class library that is equally large?

Ideally I would like to see official documentation cited from Microsoft of the issue at hand of processing the App_Code folder in Visual Studio and what happens that differs from processing a class library for example.


Solution

  • The App_Code folder is not explicitly marked as containing files written in any one programming language. Instead, the ASP.NET infers which compiler to invoke for the App_Code folder based on the files it contains. If the App_Code folder contains .vb files, ASP.NET uses the Visual Basic compiler; if it contains .cs files, ASP.NET uses the C# compiler, and so on.

    If the App_Code folder contains only files where the programming language is ambiguous, such as a .wsdl file, ASP.NET uses the default compiler for Web applications, as established in the compilation element of the application Web.config file or the machine-level Web.config file. Compilers are named build providers and a build provider is specified for each file extension in an extension element.

    See the documentation here.