开发者

My ASP.NET Web Application cannot 'find' any of my classes in the App_Code folder ..?

开发者 https://www.devze.com 2022-12-24 21:16 出处:网络
I\'m trying to make a new asp.net web application .. so I\'m copying my files from one site to the new one, in the same solution.

I'm trying to make a new asp.net web application .. so I'm copying my files from one site to the new one, in the same solution.

Now, any of my classes in the App_Code directory ... they are not getting 'picked up' by the rest of my project.

For example...

\_
\_App_Code
  |_ BaseMasterPage.cs  (please don't ask why this is in here..)
  |_ Ut开发者_运维问答ility.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
    { .. }
}

It cannot find the App_Code.BaseMasterPage (compilation and intellisence error) in the Default.master.cs page.

I'm wondering if there's something i need to check in a web.config file? or in the .prj file or something?

Can someone please help? this is killing me :(

Update

I've been constantly trying more and more things here. I had a look at the compiler options (in the OUTPUT window) .. and noticed the /target flag, on 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's missing ALL of my .cs files from the App_Code folder, except two, which I can confirm show up in the intellisence and compile fine, when called/consumed.

WTF? it's like the .. project .. doesn't know about the other .cs files, even though they have been included into the project (and are not grey'd out, etc).

What the?!

Please, can anyone help ? :~(


In the solution explorer, right click on the class.cs file, view it's properties and set the build action to 'compile' instead of 'content'


Several guesses :

try replacing the namespace

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

or/and Have a look at the properties of the file in VS, make sure they are not embedded ressource or something of the kind.

last thing have a look at the default namespace in your application

0

精彩评论

暂无评论...
验证码 换一张
取 消