简体   繁体   中英

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:

Error 1 The type or namespace name 'GUI' does not exist in the namespace 'WindowsFormsApplication2' (are you missing an assembly reference?)

Same for the "Images" folder, but using BL folder works just fine. 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.

You probably created Form1 in a different folder, then moved it to the GUI folder, so that its namespace is not what you expect.
Open both Form1.cs and Form1.Designer.cs and change the namespace.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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