.net core 2.0 error running console app on ubuntu

Viewed 5583

I'm trying to run my first .net core 2.0 console app on ubuntu 16.04-x64. I followed the steps to publish my app for ubuntu:

dotnet publish -c release -r ubuntu.16.04-x64

and also tried it from Visual Studio by changing my .csproj file like so:

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

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.0</TargetFramework>
    <RuntimeIdentifiers>ubuntu.16.04-x64</RuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="sharpadbclient" Version="2.1.0" />
    <PackageReference Include="System.IO.Ports" Version="4.4.0" />
  </ItemGroup>

</Project>

and then publish it with a publish profile.

I followed the instruction from Microsoft to install .net core on ubuntu. I copied the published output to the PC running ubuntu ans when I'm trying to run the .dll file of my console app I'm getting this error:

Unhandled Exception: System.IO.FileLoadException: 
Could not load file or assembly
'System.Console, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
The located assembly's manifest definition does not match the assembly reference.
(Exception from HRESULT: 0x80131040)
   at LinuxVersion.Program.InitializeComponent()
   at LinuxVersion.Program.Main(String[] args)
Aborted (core dumped) 

When I'm running dotnet restore I'm getting a message saying:

MSBUILD : error MSB1003: Specify a project or solution file.
The current working directory does not contain a project or solution file.

Am I missing a step here in the process?

1 Answers
Related