Class File In App_Code Folder Not Working – ASP.NET MVC

Today, we have started to migrate the website (ASP.NET 2.0 Website) to ASP.NET MVC. As per the standard practice, we have created a class and put it inside of the App_Code folder in ASP.NET MVC 4.0. However, we cannot access it from controller.

After getting some research,

  1. App_Code folder is a special ASP.NET run-time folder
  2. All MVC project is Web Application Projects (WAP) instead of Web Site projects. This means that there’s no need for an App_Code folder since WAPs always get compiled anyway. That means that all *.cs files in your project will get compiled, as opposed to Web Site projects where only *.cs files in your App_Code folder would get compiled.


  1. Go to App_Code folder – right click on the .cs file and check the property
  2. Set “Build Action” is set to “Compile”
  3. Build the solution and its working fine.


Amit Patriwala

(Manager –


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s