且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Linux 上运行 .NET Core 控制台应用程序

更新时间:2023-02-19 19:26:27

按照以下步骤运行您的应用程序:

Follow the below steps to run your application:

  1. 将您的应用程序发布为自包含应用程序:

  1. Publish your application as a self contained application:

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

  • publish文件夹复制到Ubuntu机器

  • Copy the publish folder to the Ubuntu machine

    打开Ubuntu机器终端(CLI)并进入项目目录

    Open the Ubuntu machine terminal (CLI) and go to the project directory

    提供执行权限:

    chmod 777 ./appname
    

  • 执行应用程序

  • Execute the application

    ./appname