DOTNET on Red Hat Enterprise Linux_Cove

.NET on Red Hat Enterprise Linux

Don Schenck
English

Download Cheat sheet

About

Now that Windows developers can write code that runs on Red Hat Enterprise Linux (RHEL) with almost no learning curve, the app dev environment is changing. .NET developers can now move into microservices. Getting started can be easy, too.

In this cheat sheet, author Don Schenck provides the basics on how to:

  • Install .NET Core 2.0 on Red Hat Enterprise Linux
  • Get to a Hello World
  • Get a simple program running
  • Run your .NET code in a Linux container

With Red Hat Developer cheat sheets, you get essential information right at your fingertips so you can work faster and smarter. Easily learn new technologies and coding concepts and quickly find the answers you need.

Excerpt

dotnet --help

The --help flag will display help for the lowest-level available based on the dotnet command you’ve typed.dotnet --help gives you broad help about the dotnet command, while dotnet new --help gives you more detailed help about the dotnet new command, and so on.

dotnet new [options]

The dotnet new command is used to create a new project. This function uses the dotnet templating engine, which is continually evolving. It can be found at https://github.com/dotnet/templating.

For example, to create an MVC ASP.NET web site, you would run the following command:

dotnet new mvc

This creates a web site using C# as the language. Adding the --language F# flag will create source code in F#.

dotnet restore

The dotnet restore command will retrieve the dependency libraries needed for your application as defined in the project file. By default, the command will download the libraries from https://www.nuget.org. Note that dotnet restore will run automatically when building an application unless you use the --no-restore flag.

dotnet add

The dotnet add command is used to insert a reference into your project file. While you can, if you wish, manually edit your project file, this command makes it easier to add a reference. For example, if you wish to reference the NuGet package “Json.NET” in your project, you would use the following command:

dotnet add package Newtonsoft.Json

Related Cheat sheets