publishing a .net core app

So i've been messing around with .net core.

thought it might be useful to show you how to create and publish a simple helloworld .net core console application.

getting started

Once you've installed the bits it's pretty easy to get a console application up and running.

The following generates a new console application.

mkdir hellooo  
cd hellooo  
dotnet new  

Once the project is generated, you can get it up and running by doing the following.

dotnet restore  
dotnet build  
dotnet run  

And there we go, a .net console application running natively on a mac.

publishing the app

The only thing that is slightly annoying is that everytime that i run the application, it gives me the following compilation warning...

christopherhay$ dotnet run  
Project hellooo (.NETCoreApp,Version=v1.0) was previously compiled. Skipping compilation.  
Hello World!  

This is because we're dynamically generating the app on run and not producing a runtime version.

So if we need to do a published version, then it's pretty easy..

dotnet restore  
dotnet build  
dotnet publish  

This will stick the published dll into


which we can then execute with the following command

dotnet bin/Debug/netcoreapp1.0/publish/hellooo.dll  

And the annoying compilation message is now gone, whoop whoop

christopherhay$ dotnet bin/Debug/netcoreapp1.0/publish/hellooo.dll  
Hello World!  

chris hay

Read more posts by this author.