.Net Core On Ubuntu 18.04

As a Microsoft’s open source development initiative “.Net Core” is growing leaps and bounds, I decided to give it a try on Ubuntu 18.04 environment. Online guide for .Net Core is really rich and well defined but at a time it may become overwhelming following it for particular platform, especially on Linux (Ubuntu here). My goal is to follow same guide in context of Ubuntu system here.

.Net Core SDK Installation / Upgrade:

First step in setting up development environment is install .Net Core SDK that contains everything you need to develop and run .Net Core application on Ubuntu. To install .Net Core SDK is 2.2 (current stable version), please run below commands in terminal.

No need to run following command while upgrading .Net Core SDK.

wget -q https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

sudo dpkg -i packages-microsoft-prod.deb

sudo add-apt-repository universe

Run following commands to install / upgrade existing .Net Core SDK.

sudo apt-get install apt-transport-https

sudo apt-get update

apt-get install dotnet-sdk-2.2

Verify sdk installation / upgrade by running following command

dotnet –version

Installation / upgrade is same process except initial steps need to be run only for first time installation. Screenshot shown here might show different text on fresh installation as I tried to take those after installation.

Upgrading to particular version may require to change version number while running command. In addition to that please make sure you change your existing project files to refer to new version. ASP.NET Core project may require quite a few modifications (well mentioned on .net guide) but for small simple .Net Core project please make sure to change TargetFramwork in csproj, vbproj or fsproj file depending on a language you are using for developement.

Migration from version 2.1 to 2.2 requires removing <DotNetCliToolReference> entry from project file as it is no longer required.

<Project Sdk="Microsoft.NET.Sdk.Web">

  <PropertyGroup>
    <TargetFramework>netcoreapp2.2</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <Folder Include="wwwroot\" />
  </ItemGroup>

 ...
...

Please let me know if you have any question while following particular step.

Leave a Reply

Your email address will not be published. Required fields are marked *