My ASP.NET web application cannot "find" any of my classes in the App_Code .. folder?

I am trying to create a new asp.net web application .. so I copy my files from one site to a new one in the same solution.

Now, any of my classes in the App_Code directory ... they do not get "picked up" by the rest of my project.

For example...

 \_ \_App_Code |_ BaseMasterPage.cs (please don't ask why this is in here..) |_ Utility.cs |_ FooBar.cs \_MasterPages |_ Default.master.cs // This file errors ;( namespace Foo.WebSite.MasterPages { public partial class Default_master : App_Code.BaseMasterPage { ... } } namespace Foo.WebSite.App_Code { public class BaseMasterPage : MasterPage { .. } } 

Cannot find App_Code.BaseMasterPage (compilation and intellisence error) on the Default.master.cs page.

I am wondering if there is something that needs to be checked in the web.config file? or in a .prj file or something like that?

Can anybody help? this is killing me: (

Update

I constantly do more and more. I looked at the compiler options (in the OUTPUT window) .. and noticed the / target flag, in the compiler call ...

 eg... /target:library App_GlobalResources\GlobalResources.designer.cs App_GlobalResources\GlobalResources.en-au.designer.cs App_GlobalResources\GlobalResources.it.designer.cs 

etc...

it skips ALL of my .cs files from the App_Code folder, with the exception of two, which I can confirm by detecting that intellisence compiles fines on invocation / consumption.

WTF? it's like a project .. doesn't know about other .cs files, even if they were included in the project (and not grey'd out, etc.).

What??

Please help ?: ~ (

+7
webforms app-code
source share
2 answers

A few hunches:

try replacing the namespace

  namespace Foo.WebSite.MasterPages { public partial class Default_master : Foo.WebSite.App_Code.BaseMasterPage { ... } } 

and / and take a look at the file properties in VS, make sure that they are not embedded in ressource or something like that.

the last thing you look at is the default namespace in your application

+8
source share

In the solution explorer, right-click on the class.cs file, view its properties and set the assembly action to “compile” instead of “content”

+10
source share

All Articles