J
Jay
Guest
Jay Asks: Why is visual studio code printing C# to terminal correctly, but not output?
I'm new to C#. I installed Visual Studio code along with the NET framework, and when I run my project in the terminal via 'dotnet run', everything works perfectly.
Yet, when I switch over to the output window I see this message --
Can anyone lead me in the right direction? I've been going at it for 10 hours now - research, reinstalls, and restarts galore - yet nothing seems to help. Again I stress: in the visual studio terminal, the code works fine.
What gives?
Edit: I manually added scriptcs to path, and now the error has change - "You cannot declare namespace in script code"
This is what happens without namespace; still no output.
I'm new to C#. I installed Visual Studio code along with the NET framework, and when I run my project in the terminal via 'dotnet run', everything works perfectly.
Yet, when I switch over to the output window I see this message --
Can anyone lead me in the right direction? I've been going at it for 10 hours now - research, reinstalls, and restarts galore - yet nothing seems to help. Again I stress: in the visual studio terminal, the code works fine.
What gives?
Edit: I manually added scriptcs to path, and now the error has change - "You cannot declare namespace in script code"
Code:
using System;
namespace HelloWorld
{
class Hello
{
static void Main()
{
Console.WriteLine("Hello World!");
// Keep the console window open in debug mode.
Console.WriteLine("Press any key to exit.");
Console.ReadKey();
}
}
}
This is what happens without namespace; still no output.
SolveForum.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, solveforum.