❔ How do i run a c# program
Hello I wrote a new program in .txt file, how do i run this? It goes: Console WriteLine ()"Hello World"
7 Replies
c# is strictly project-based
you can't just run a single file
and especially not a .txt file
and especially not with that code, as it is invalid
$helloworld
Written interactive course https://learn.microsoft.com/en-us/users/dotnet/collections/yz26f8y64n7k07
Videos https://dotnet.microsoft.com/learn/videos
1: Do you have the .NET SDK installed? What happens if you run
dotnet --list-sdks
?
2: You have to create a project in order to run your code. To do this, you have to create a project using dotnet new console
, thrn you can write your code in the Program.cs
file that is generated.
3: Rundotnet run
in order to run your code.
All your C# code have to be in .cs
files, in addition to having a .csproj
file at the root of your project.
And also, as mentioned, Console WriteLine ()"Hello World"
is invalid code, the tutorial linked above should help you get started.for starter, try use this
https://www.programiz.com/csharp-programming/online-compiler/
atleast, you dont need to download much..And it is much easy to compile and retrieve output..Goodluck 🙂
Please note, that this is only for console output..If you're looking for making a launcher or any framework, use Visual Studio
Online C# Compiler (Editor)
The user friendly C# online compiler that allows you to write C# code and run it online. The C# text editor also supports taking input from the user and standard libraries. It uses the mono compiler to compile code.
doesn't look that good, I'm going to suggest https://dotnetfiddle.net/
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.
Was this issue resolved? If so, run /close
- otherwise I will mark this as stale and this post will be archived until there is new activity.