Larsenal
Larsenal

Reputation: 51186

How to compile a C# file outside of App_Code?

I'd like to stick a class down in my folder hierarchy. The scenario is too trivial to warrant it's own project or separate website. However, I hate to clutter my top-level App_Code with something that's used by a tiny corner of the site.

Is there a way in web.config to include another file or folder in the compilation process?

Upvotes: 3

Views: 865

Answers (2)

DuckMaestro
DuckMaestro

Reputation: 15905

It sounds like you are using the "Web Site" project type. You might consider switching to the "Web Application" project type which works more like a traditional project, allowing you to have a much more flexible folder structure (code can go anywhere you like, and App_Code isn't a special folder).

This post has a brief discussion and links on the pros/cons of Web Site vs. Web Application projects:

http://forums.asp.net/p/1233004/2232697.aspx#2232697

Upvotes: 1

tsilb
tsilb

Reputation: 8035

<configuration>
   <system.web>
      <compilation>
         <assemblies>
            <add assembly="<AssemblyName>, Version=<Version>, Culture=<Culture>, PublicKeyToken=<PublicKeyToken>"/>
         </assemblies>
      </compilation>
   </system.web>
</configuration>

Upvotes: 0

Related Questions