DEV Community

Discussion on: How to update my .NET C# compiler (csc)?

 
baenencalin profile image
Calin Baenen

Can you explain what exactly this does?
I really don't understand, and I can't see why there isn't a dotnet compile <file)s)>.

Thanks for your help.
Cheers.

Thread Thread
 
mileswatson profile image
Miles Watson • Edited

Doing dotnet new console creates a new “console” project in the current directory.

It creates two files - a .csproj and a Program.cs file. The Program.cs file contains your code (you can add as many extra cs files as you want). The .csproj file contains information that helps the compiler understand how to build (aka compile) your project. For example, what libraries to use, what framework to build it for, whether to ignore certain warnings etc. The obj/ folder can be ignored.

In that project directory, you can use the command dotnet run to run your project. Alternatively, you can do dotnet build to compile it, and then you can manually click the exe in the bin folder.

It is worth installing visual studio, as it provides a nice interface to manage all this stuff.