3

I am making multiple sub folders in my App_Code folder to organize my classes and it seems it is working fine, is there any restriction on that?

like:

  • App_Code
    • Ui
      • TextBoxes
      • Labels

3 Answers 3

2

I found this interesting piece of information looking for information on App_Code so thought I'd share.

However, you can configure your Web application to treat subfolders of the App_Code folder as separate compilable units. Each folder can then contain source code in a different programming language. The configuration is specified by creating a codeSubDirectories element in the compilation element of the Web.config file and adding a reference to the subfolder. The following example illustrates how you would configure subfolders named VBCode and CSCode to compile into separate assemblies:

<compilation debug="false">
    <codeSubDirectories>
        <add directoryName="VBCode" />
        <add directoryName="CSCode" />
    </codeSubDirectories>
</compilation>

The references to the VBCode and CSCode subfolders do not need to include any information about what programming language is contained in the subfolder. As with the App_Code folder itself, ASP.NET infers the compiler to use based on the files in the subfolder.

Sign up to request clarification or add additional context in comments.

Comments

1

Absolutely No Restrictions. Sub-Directories are just FileSystem Grouping, you will have to assign the namespaces manually to all your classes in App_Code.

1 Comment

Weird, as soon as I move my vbhtml file (that contains functions/helpers) to a sub directory within App_Code, my source that calls it can't find it anymore. So yes, there are restrictions apparently?
1

I don't believe there is any restriction. I have done this on many projects without a problem.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.