0

How to add a reference to the App_code directory for a sub-folder in web project

I have been given a task to take an older, grown piecemeal over a decade internal website and bring it "up to speed". I have run into a problem in ASP files to "see" the app_code directory. Essentially the current site is a collection of folders that work(ish) that I am trying to collect together as a single project with the LEAST number of edits.

When functionality was superseded the old code was moved into a "deprecated" folder. The code files now reference object in the app_code directory which is not visible to the file from it's new location. The easy answer would be to copy a version of the class file into the "deprecated" folder but that seems more like a hack then a solution. The same for copying the App_code folder to a location visible to the ASP file.

My thought was to add a reference ("reference path") somehow to the deprecated folder pointing to the app_code folder but I cannot find how to do that.

A couple of other notes: 1) the site was built by using text editors and "freebie" editors - it has never been compiled or run in-total through VS before. 2) once I get it built and checked into TFS I am going to remove the deprecated folders. 3) I am working under some stipulations to satisfy concerns arising from actions of prior developers.

Code like:

tr.Controls.Add(GUI.GetTableCell("Salesman", 0, "Center"));

Works well when the ASP page is at the same directory level as the App_code folder ("GUI" is a class with a "GetTableCell" function).

If I can add a folder reference I can solve all of the remaining problems I have with this step in the project.

EDIT Let me re-ask it this way. The image below is a composite of what I am facing in VS2017. I have such a feeling that a light bulb is simply not turning on for some reason. How I have done this so far is pulling down the current website from our internal Win2003 web server and am trying to convert it into a legit web project. I have done many of the steps necessary but there are 47 instances of the problem visible in the composite image from Visual studioLook from within VS

The code behind from SubscriptionEditor.aspx pictured lower right. Has reference to a namespace which is in the code files in the App_code folder (neatly hidden). This site functions fine but I am missing something to make it work from within VS. I am just at a loss.

  • I think the easy fix is to keep the deprecated stuff in the app_code folder in a folder called 'deprecated'. Keep the code together. – wazz Oct 07 '19 at 21:55
  • I was hoping to use some form of pathing via the VS toolset. The challenge is to correct the issue without changing the physical file layout. I take it by your answer that you do not know of, or there is no way. You suggestion is a mirror of copying the app_code files to the deprecated folder. – Paul Wichtendahl Oct 08 '19 at 17:20

1 Answers1

0

For anyone that finds this I want to point out that there are a number of excellent answers available for similar questions here and i have looked at dozens and tried them all. The simple answer to my problem is "you can't".

How to convert ASP.NET website to ASP.NET web application came close

The problem being the source is just a collection of ASP files - it follows no project or template.

Namespaces are super important in development and the clever ways that prior developers found to breach that discipline can not be fixed through VS. It is simple a lot of bloody knuckle corrections of code and scope issues til the errors disappear.

The limitations put on me prohibit any solution. I will end up advocating not "saving the code" unless they are willing to put in the investment to heal the most egregious foibles. So if you see me in the "available for contract" sites then you know how that conversation went.