reference app_code classes in web application project

6.7k views Asked by At

I have created an asp.net website, with the accompanying app_code folder.

In the same solution I added a web application project, and I want to use the classes that are in the website app_code folder.

I tried adding a reference, and then adding the project (the website), but the list of project is empty... Thanks.

2

There are 2 answers

0
amit_g On BEST ANSWER

You are doing it wrong. Create a class library project and move all those classes from the app_code folder to the new project. Then reference this project from both website and web application project.

0
Amal On

Very late, but sometimes classes in App_Code may need to stay in the same project, then

  1. Create a new folder (say "code" )in web application, and add class files from app_code as links to this folder. This lets you have a single copy.

2) Ensure Build Action for each of these imported files are "Compile" in the file property folder if need be.

3) Exclude App_Code folder from web application.

More information and reasons - please see here:

http://vishaljoshi.blogspot.in/2009/07/appcode-folder-doesnt-work-with-web.html