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? or in the .prj file or something?
我想知道是否需要检查web.config文件?或者在.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? 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).
WTF?它就像..项目..不知道其他.cs文件,即使它们已被包含在项目中(并且不是灰色等)。
What the?!
Please, can anyone help ? :~(
拜托,有人可以帮忙吗? :〜(
2 个解决方案
#1
8
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
最后一件事看看你的应用程序中的默认命名空间
#2
10
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'
在解决方案资源管理器中,右键单击class.cs文件,查看其属性并将构建操作设置为“compile”而不是“content”
#1
8
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
最后一件事看看你的应用程序中的默认命名空间
#2
10
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'
在解决方案资源管理器中,右键单击class.cs文件,查看其属性并将构建操作设置为“compile”而不是“content”