How to run .Net core console app on Linux [duplica

2020-02-16 08:00发布

I am using Visual Studio 2015. And created .net core Console app. After compiling in debug folder I have my project dll. And if I want to run it on another computer, I have to install dotnet on it and then write in cmd dotnet myApp.dll. But I need to run my app without any installations.

I have read, that I must publish my app. I do it with command dotnet publish -c Release. Now in folder release I have new folder publish with myApp.dll and other dll-files and folder runtimes for different systems. For example in Ubuntu.16.04-x64 folder I have file System.Security.Cryptography.Native.OpenSsl.so. But how I can run my app without any new installations of dotnet or something else?

1条回答
劳资没心,怎么记你
2楼-- · 2020-02-16 08:18

Follow the below steps to run your application:

1) Publish your application as a self contained application:

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

2) Copy publish folder to ubuntu machine

3) Open ubuntu machine terminal (CLI) and Go to the project directory

4) Provide execute permissions:

chmod 777 ./appname

5) Execute application

./appname

查看更多
登录 后发表回答