You have a wonderful problem, when Visual Studio writes C # with a hint:
"Could not find the type name or namespace name XXX (whether a using directive or assembly reference is missing)"
Check it out,
1, neither I do not have this class,
2, nor did I write "Using XXX;" To reference namespaces,
3, more than I referenced the other. dll files, forget to add references,
4. There is no spelling error in the end.
It's really a pit. Checked for a long time.
The reason for the final discovery is:
This class is not included in the compilation, and the namespace does not take effect.
Workaround:
Open the "Welcome.csproj.user" file under Project Engineering, "Welcome" is the project name.
Locate the label, and add the file for the class that does not find the type name or namespace.
such as PG PG = new PG ();
Tips:
"Could not find the type name or namespace name XXX (whether a using directive or assembly reference is missing)"
Find the corresponding file "Program1.cs" for the PG class, add:
<ItemGroup>
<compile include= "MainTest.cs"/> <compile
Include= "Program1.cs"/> <compile include= "Program2.cs"/> <compile include=
"Program3.cs"/>
<compile include= "ArrayTest.cs"/>
<compile include= "Properties\assemblyinfo.cs"/>
</ Itemgroup>
Then save, refresh, clean, and rebuild, and it's OK (maybe refreshed).
I'm surprised that vs why didn't automatically join. Maybe there's something wrong with my project.
In fact, when you create a new file, the new resource will be compiled directly into the current project from the item on the menu bar, add xx, and the item from "File"-"new"-will not be added directly to the current project, and can also cause an appeal issue.
So:
In fact, this is what the code layer renders. In fact, it can also be resolved in the Visual Studio view layer. In fact, click "Project"-"Show All Files", and then in Solution Manager you can find a C # file that is not joined to the compile queue, right-click it, and select "Include In Project (j)". The refresh is OK.
end--