reference app_code classes in web application project
Asked Answered
A

2

6

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.

Autum answered 5/11, 2011 at 0:4 Comment(0)
D
7

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.

Distinguished answered 5/11, 2011 at 0:10 Comment(0)
A
3

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

Angst answered 9/8, 2013 at 13:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.