It happened to you because of your namespace, change it or use full namespace for System.Console.WriteLine
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:
Microsoft Security | Microsoft Authenticator
4 additional answers
Sort by: Most helpful
-
Sam of Simple Samples 5,546 Reputation points
2021-04-26T16:58:46.537+00:00 Please update your tags to indicate C#.
Ensure that your project still has System for a reference, as in:
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?
-
JerryM 1,131 Reputation points
2021-04-27T16:44:15.43+00:00 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
-
Tantz 0 Reputation points
2023-01-28T21:03:07.2933333+00:00 The namespace you have chosen might conflict with the System.Console one. Try changing yours.
-
Percy 0 Reputation points
2024-10-07T08:49:58.6066667+00:00 Add access modifier public on Main method.
It should resolve your issue.
"public static void Main(String[] args)"