c# - .net core 2.0 error running console app on ubuntu -


i'm trying run first .net core 2.0 console app on ubuntu 16.04-x64. followed steps publish app ubuntu:

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

and tried visual studio changing .csproj file 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 publish publish profile.

i followed instruction microsoft install .net core on ubuntu. copied published output pc running ubuntu ans when i'm trying run .dll file of console app i'm getting error:

unhandled exception: system.io.fileloadexception:  not load file or assembly 'system.console, version=4.1.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a'. located assembly's manifest definition not match assembly reference. (exception hresult: 0x80131040)    @ linuxversion.program.initializecomponent()    @ linuxversion.program.main(string[] args) aborted (core dumped)  

when i'm running dotnet restore i'm getting message saying:

msbuild : error msb1003: specify project or solution file. current working directory not contain project or solution file. 

am missing step here in process?

well, turns out there difference between publishing app using visual studio publish profile (right clicking on project , selecting "publish") , using command line. when used visual studio publish profile got error, switched using command line so: dotnet publish -c release -r ubuntu.16.04-x64 run went publish folder of output: cd /home/myapp/publish , run app using dotnet myappname.dll.

this solved me.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -