Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

reference app_code classes in web application project

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.

like image 880
user560498 Avatar asked Nov 05 '11 00:11

user560498


2 Answers

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.

like image 81
amit_g Avatar answered Nov 15 '22 06:11

amit_g


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

like image 32
Amal Avatar answered Nov 15 '22 07:11

Amal