简体   繁体   English

我的ASP.NET Web应用程序无法“找到”App_Code文件夹中的任何类..?

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

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. 我正在尝试创建一个新的asp.net Web应用程序..所以我在同一个解决方案中将我的文件从一个站点复制到新站点。

Now, any of my classes in the App_Code directory ... they are not getting 'picked up' by the rest of my project. 现在,我在App_Code目录中的任何类......他们都没有被我的项目的其余部分“拾起”。

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
    { .. }
}

It cannot find the App_Code.BaseMasterPage (compilation and intellisence error) in the Default.master.cs page. 它无法在Default.master.cs页面中找到App_Code.BaseMasterPage (编译和智能错误)。

I'm wondering if there's something i need to check in a web.config file? 我想知道是否需要检查web.config文件? or in the .prj file or something? 或者在.prj文件中还是什么?

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... 我查看了编译器选项(在OUTPUT窗口中)..并注意到编译器调用上的/ target标志...

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. 它缺少来自App_Code文件夹的所有.cs文件,除了两个,我可以确认在智能中显示并且在被调用/消费时编译正常。

WTF? 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). 它就像..项目..不知道其他.cs文件,即使它们已被包含在项目中(并且不是灰色等)。

What the?! 什么?!

Please, can anyone help ? 拜托,有人可以帮忙吗? :~( :〜(

在解决方案资源管理器中,右键单击class.cs文件,查看其属性并将构建操作设置为“compile”而不是“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. 或者/并查看VS中文件的属性,确保它们不是嵌入式资源或类似的东西。

last thing have a look at the default namespace in your application 最后一件事看看你的应用程序中的默认命名空间

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM