Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

compiling c# code via the cli on linux with the official .NET SDK

With mono you'd compile and run C# code by doing csc test.cs && mono test.exe. How would you do it with the official .NET SDK on Ubuntu?

like image 849
neubert Avatar asked Jan 26 '26 07:01

neubert


1 Answers

Depending on what your goal is:

  • dotnet run - This will build and run your application directly
  • dotnet test - This will build everything and run your unit tests
  • dotnet publish - This will build your application for deployment
  • dotnet build - This will build your application (for development only). Generally, you don' want to use this: one of the others on this list will be a better way to do what you want. If you want to share this with users, you want dotnet publish instead.
like image 122
omajid Avatar answered Jan 27 '26 23:01

omajid



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!