question

JerryM-2071 avatar image
0 Votes"
JerryM-2071 asked srdobrais commented

MS VS C# Console app does not work. Why??? There is indeed .NET5, Am I imbecile ?

Hi boys and girls from MS .NET5 project,
I have MS VS 2019 16.9.4. I created standard .NET core Console Desktop App in C#.
And I tried to run it .. .but ... nothing !!! An error arose:

Error CS0234: The type or namespace name 'WriteLine' does not exist in the namespace 'Console' (are you missing an assembly reference?)

Why ???? Am I imbecile ? Maybe yes :)
See the image what I see:

91188-err.jpg


microsoft-authenticator
err.jpg (304.5 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Shoxik-5157 avatar image
2 Votes"
Shoxik-5157 answered srdobrais commented

It happened to you because of your namespace, change it or use full namespace for System.Console.WriteLine

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

It's amazing! Even I, an apprentice of everything and master of nothing, know like tattooed on fire, that NEVER and I repeat NEVER should use reserved words as names, and "Console" is one of them (the first one you learn in "Hello World"). It should have more votes and visits.

0 Votes 0 ·
JerryM-2071 avatar image
0 Votes"
JerryM-2071 answered

there is no assemblies item on the right side of the menu ..
never mind ..
it is maybe "a queer" console project :)

there is the console project source code

https://drive.google.com/file/d/1qpm01r52mXO8yDtuBGG84uIrZoVAZVp8/view?usp=sharing

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

SimpleSamples avatar image
0 Votes"
SimpleSamples answered SimpleSamples edited

Please update your tags to indicate C#.

Ensure that your project still has System for a reference, as in:

91336-vsreferencemanager.jpg

You can do that by selecting the Project menu then selecting Add Reference... then scroll down.

If that is not the problem then does the problem occur if you create a new project?





5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.