Trying .NET Core on Linux with just a tarball (without apt-get)

Dev Tips

There’s a great post on the .NET Blog about the crazy Performance Improvements in .NET Core that ended up on Hacker News. The top comment on HN is a great one that points out that the  website could be simpler, that it could be a one-pager with a clearer Getting Started experience.

They also said this:

Also, have a simple downloadable .tar.gz which expands into /bin + /lib + /examples. I loved C# back in my Windows days and I moved to Linux to escape Microsoft complexities and over-reliance on complex IDEs and tools, scattered like shrapnel all over my c:/

I will not run apt-get against your repo without knowing ahead of time what I’m getting and where will it all go, so let me play with the tarball first.

This is a great point, and we’re going to look at revamping and simplifying the with this in mind in the next few weeks. They’re saying that the Linux instructions, like these instructions on installing .NET Core on Ubuntu for example, make you trust a 3rd party apt repro and apt-get .NET, while they want a more non-committal option. This gets to the larger “the website is getting bigger than it needs to be and confusing” point.

Trying out .NET Core from a tarball

Go to and download the .tar.gz for your distro to a nice local area.

NOTE: You MAY need to apt-get install libunwind8 if you get an error like “Failed to load /home/ubuntu/teste-dotnet-rc2/, error: cannot open shared object file: No such file or directory” but libunwind isn’t very controversial.

Once you’ve unziped/tar’d it into a local folder, just be sure to run dotnet from that folder.

Desktop $ mkdir dotnetlinux
Desktop $ cd dotnetlinux/
dotnetlinux $ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
dotnetlinux $ curl -o dotnet.tar.gz
dotnetlinux $ tar -xvf dotnet.tar.gz
dotnetlinux $ cd /mnt/c/Users/scott/Desktop/localdotnettest/
localdotnettest $ ../dotnetlinux/dotnet new console
Content generation time: 103.842 ms
The template "Console Application" created successfully.
localdotnettest $ ../dotnetlinux/dotnet restore
Restoring packages for /mnt/c/Users/scott/Desktop/localdotnettest/localdotnettest.csproj...
localdotnettest $ ../dotnetlinux/dotnet run
Hello World!

There aren’t samples in this tar file (yet) but there are (some weak) samples at you can clone and run them from samples. Note from the ReadMe that is the jumping off point for the other repos.

The more interesting “samples” are the templates you have available to you from “dotnet new.”

localdotnettest $ /mnt/c/Users/scott/Desktop/dotnetlinux/dotnet new

Templates Short Name Language Tags
Console Application console [C#], F# Common/Console
Class library classlib [C#], F# Common/Library
Unit Test Project mstest [C#], F# Test/MSTest
xUnit Test Project xunit [C#], F# Test/xUnit
ASP.NET Core Empty web [C#] Web/Empty
ASP.NET Core Web App mvc [C#], F# Web/MVC
ASP.NET Core Web API webapi [C#] Web/WebAPI
Solution File sln Solution

dotnet new mvc --auth None --framework netcoreapp1.1
dotnet new classlib
dotnet new --help

From here you can “dotnet new web” or “dotnet new console” using your local dotnet before you decide to commit to installing .NET Core from an apt repo or yum or whatever.

Sponsor: Check out Seq: simple centralized logging, on your infrastructure, with great support for ASP.NET Core and Serilog. Download version 4.0.

Source link

Leave a Reply