[英]Can't use folders although I have them in Solution Explorer [Visual Studio 2012]
I created three separate folders (BL, GUI, IMAGES) under the same namespace, yet when I try to use them I get a compile error: 我在同一名称空间下创建了三个单独的文件夹(BL,GUI,IMAGES),但是当我尝试使用它们时,我收到了一个编译错误:
Error 1 The type or namespace name 'GUI' does not exist in the namespace 'WindowsFormsApplication2' (are you missing an assembly reference?)
错误1命名空间“WindowsFormsApplication2”中不存在类型或命名空间名称“GUI”(您是否缺少程序集引用?)
Same for the "Images" folder, but using BL folder works just fine. “Images”文件夹相同,但使用BL文件夹工作正常。 So what's the problem?
所以有什么问题? I always lay down my projects into several folders and use them just fine, but now I don't know what to do.
我总是将我的项目放入几个文件夹并使用它们很好,但现在我不知道该怎么做。
The compiler doesn't care what folders your files are in. 编译器不关心文件所在的文件夹。
The namespace is determined by the namespace ...
line in each file, which Visual Studio will set to the current folder by default. 命名空间由每个文件中的
namespace ...
行确定,默认情况下Visual Studio将设置为当前文件夹。
You probably created Form1
in a different folder, then moved it to the GUI
folder, so that its namespace is not what you expect. 您可能在另一个文件夹中创建了
Form1
,然后将其移动到GUI
文件夹,因此它的命名空间不是您所期望的。
Open both Form1.cs
and Form1.Designer.cs
and change the namespace. 打开
Form1.cs
和Form1.Designer.cs
并更改名称空间。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.