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

JerryM 1,131 Reputation points
2021-04-26T10:24:08.68+00:00

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 Security | Microsoft Authenticator
0 comments No comments
{count} votes

Accepted answer
  1. Shoxik 86 Reputation points
    2021-07-20T13:36:09.137+00:00

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

    2 people found this answer helpful.

4 additional answers

Sort by: Most helpful
  1. 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:

    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?

    0 comments No comments

  2. 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

    0 comments No comments

  3. 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.

    0 comments No comments

  4. 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)"

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.