views:

390

answers:

2

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?

A: 
<configuration>
   <system.web>
      <compilation>
         <assemblies>
            <add assembly="<AssemblyName>, Version=<Version>, Culture=<Culture>, PublicKeyToken=<PublicKeyToken>"/>
         </assemblies>
      </compilation>
   </system.web>
</configuration>
tsilb
How do I specify a specific file to compile?
Larsenal
Really, you should put it in App_Code. If your App_Code is so large you have to worry about clutter, look into dividing it up into multiple Projects.
tsilb
+1  A: 

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

DuckMaestro
Due to other factors on the team, we're stuck with a "Web Site" project for now. Is there any way to do it in a "Web Site" project?
Larsenal