Install .NET Core on Mint 18 or Elementary OS
- Posted in:
- Web dev
If you try to install latest .NET Core SDK 1.0.1 on Mint 18 or Elementary OS Loki (based on Ubuntu 14.04 and 16.04 LTS) by following instructions on http://get.asp.net, you might see this error:
mint-vbox hudo # sudo apt-get install dotnet-dev-1.0.0-preview2-003131
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:The following packages have unmet dependencies:
dotnet-dev-1.0.0-preview2-003131 : Depends: dotnet-sharedframework-microsoft.netcore.app-1.0.1 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
dotnet-sharedframework-microsoft.netcore.app-1.0.1 is missing, but if you try to apt-get that, then dependent libicu52 is missing, only libicu55 is in Ubuntu repository.
We can get it from this Url, by downloading .deb file: https://launchpad.net/ubuntu/wily/amd64/libicu52/52.1-8 (you’ll probably choose Arm64 release binary)
Since we can’t just execute this .deb by double-clicking on it (at least on Elementary OS), we have to move it to repo cache and use apt-get install, or better, use gdebi utility (Mint 18 already includes it):
sudo apt-get install gdebi
If we double-click to downloaded .deb file now, a window will appear offering:
After that, executing last .net core installation step takes us to the happy place :
mint-vbox hudo # sudo apt-get install dotnet-dev-1.0.0-preview2-003131
Reading package lists... Done
….Setting up dotnet-sharedframework-microsoft.netcore.app-1.0.1 (1.0.1-1) ...
Setting up dotnet-dev-1.0.0-preview2-003131 (1.0.0-preview2-003131-1) ...
This software may collect information about you and your use of the software, and send that to Microsoft.
Please visit http://aka.ms/dotnet-cli-eula for more information.
Processing triggers for libc-bin (2.23-0ubuntu4) ...
hudo-VirtualBox hudo # dotnetMicrosoft .NET Core Shared Framework Host
Version : 1.0.1
Build : cee57bf6c981237d80aa1631cfe83cb9ba329f12Usage: dotnet [common-options] [[options] path-to-application]
Common Options:
--help Display .NET Core Shared Framework Host help.
--version Display .NET Core Shared Framework Host version.Options:
--fx-version <version> Version of the installed Shared Framework to use to run the application.
--additionalprobingpath <path> Path containing probing policy and assemblies to probe for.Path to Application:
The path to a .NET Core managed application, dll or exe file to execute.If you are debugging the Shared Framework Host, set 'COREHOST_TRACE' to '1' in your environment.
To get started on developing applications for .NET Core, install .NET SDK from:
http://go.microsoft.com/fwlink/?LinkID=798306&clcid=0x409
mint-vbox hudo #
Visual Studio Code and Omnisharp support
Since elementary OS 0.4 Loki, platform Id changed from “elementary OS” to “elementary”. To fix Omnisharp problem of not recognizing this version of OS, edit platform.js file in /home/username/.vscode/extensions/ms-vscode.csharp-1.4.1/out/ by changing line (I removed “OS” in line 76):
case 'elementary':
on mint, this case branch needs to be added to the end of switch statement:
case 'linuxmint':
var versionId = getValue("VERSION_ID");
if (versionId.startsWith("17")) {
// This also works for Linux Mint
return Platform.Ubuntu14;
}
else if (versionId.startsWith("18")) {
return Platform.Ubuntu16;
}
break;
Don’t forget to restart VS Code after changing platform.js. Hopefully, VS Code and Omnisharp will be able to recognize the project, install necessary files, like build tasks and debugger support!