Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
89 lines (66 sloc) 2.54 KB


Hello World with the .NET CLI

  1. Install the dotnet CLI for your platform from

  2. Open a command prompt and navigate to the directory without spaces (This is a known issue) and make a new directory called cliapplication and navigate to it:

mkdir cliapplication
cd cliapplication
  1. Create a new project by typing dotnet new in the cliapplication folder.
  2. Restore packages by typing dotnet restore.
  3. Run the hello world application dotnet run.

Compile and run manually

  1. Run dotnet build
  2. Execute the executable in bin/Debug/dnxcore50 e.g.:

It should print out hello world

Configure the CLI application to use ASP.NET

  1. Edit the NuGet.config in the cliapplication folder and add an entry for the ASP.NET myget feed <add key="aspnet-ci-dev" value="" />:
<?xml version="1.0" encoding="utf-8"?>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="dotnet-core" value="" />
    <add key="" value="" />
    <add key="aspnet-ci-dev" value="" />
  1. Add the Microsoft.AspNet.Server.Kestrel package to project.json:
"dependencies": {
  "NETStandard.Library": "1.0.0-rc2-23704",
  "Microsoft.AspNet.Server.Kestrel": "1.0.0-*"
  1. Run dotnet restore in the project folder to restore packages.
  2. Add a Startup.cs with the following content:
public class Startup
    public void Configure(IApplicationBuilder app)
        app.Run(context =>
            return context.Response.WriteAsync("Hello World!");
  1. Add code to the Program.cs Main method that boots up ASP.NET.
public static void Main(string[] args)
    var app = new WebApplicationBuilder()

  1. Type dotnet run to execute the application. Open a browser and open a browser window to http://localhost:5001, you should see a "Hello World" response.