我的 ASP.NET Web 应用程序无法“找到” App_Code 文件夹中我的任何课程..?
我正在尝试创建一个新的 asp.net Web 应用程序..因此我在同一解决方案中将我的文件从一个站点复制到新站点。
现在,我的 App_Code
目录中的任何类......它们都不会被我的项目的其余部分“拾取”。
例如...
\_
\_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
{ .. }
}
它在Default.master.cs
页面中找不到App_Code.BaseMasterPage
(编译和智能错误)。
我想知道是否需要在 web.config 文件中检查某些内容?或在 .prj 文件或其他文件中?
有人可以帮忙吗?这简直要了我的命:(
更新
我在这里不断尝试越来越多的事情。我查看了编译器选项(在输出窗口中)..并注意到编译器调用上的 /target 标志...
eg...
/target:library App_GlobalResources\GlobalResources.designer.cs
App_GlobalResources\GlobalResources.en-au.designer.cs
App_GlobalResources\GlobalResources.it.designer.cs
等...
它丢失了 App_Code 文件夹中的所有 .cs 文件,除了两个,我可以确认它们在智能中显示并编译良好,当调用/使用时,
这就像 .. 项目 .. 没有。了解其他 .cs 文件,即使它们已包含在项目中(并且未显示为灰色等)
?!
有人可以帮忙吗?
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..)
|_ 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.
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 ? :~(
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在解决方案资源管理器中,右键单击 class.cs 文件,查看其属性并将构建操作设置为“编译”而不是“内容”
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'
几个猜测:
尝试替换命名空间
或/和看看VS中文件的属性,make
确保它们不是嵌入式资源
或类似的东西。
最后一件事是查看应用程序中的默认名称空间
Several guesses :
try replacing the namespace
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