简体   繁体   English

虽然我在解决方案资源管理器中有它们但不能使用文件夹[Visual Studio 2012]

[英]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.csForm1.Designer.cs并更改名称空间。

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

相关问题 尽管在目录中,Visual Studio找不到符号,并且类也未显示在解决方案资源管理器中 - Visual Studio cannot find symbol and class doesn't show up in solution explorer although it is in directory 无法在Visual Studio 2012中使用FileSystemWatcher - Can't use FileSystemWatcher in Visual Studio 2012 visual studio — 无法从解决方案资源管理器中删除文件 - visual studio — can't remove files from solution explorer 解释解决方案资源管理器ASP.NET Visual Studio 2012 - Explaining the Solution Explorer ASP.NET Visual studio 2012 Visual Studio 2012:项目和解决方案资源管理器所需的帮助 - visual studio 2012: Help needed with projects and solution explorer 无法访问Visual Studio 2010解决方案资源管理器中的文件夹 - Cannot access folders in Visual Studio 2010 Solution Explorer 在解决方案资源管理器下的 Visual Studio 解决方案中创建的文件夹未出现在源代码管理资源管理器中 - Folders created in visual studio solution under solution explorer not appearing in source control explorer Visual Studio 2012无法使用Web表单模板 - Visual Studio 2012 Can't use web form template 我的计时器不起作用(我使用Visual Studio 2012) - My timer won't function (I use Visual Studio 2012) 我无法在Visual Studio 2012上执行项目 - I can't execute a project on Visual Studio 2012
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM