How to Publish Your ASP.Net Core App for Linux/Ubuntu

Requirements

  • ASP.Net Core Application
  • Visual Studio *or* Dotnet Core SDK

Steps

1. Open one of the following

  • Package Manager in Visual Studio
  • Powershell in your Project folder
  • Terminal in your Project folder
  • cmd in your Project Folder

2. Run the following command

dotnet publish --self-contained -c Release -r linux-x64

Deploy your app

The previous command will instruct dotnet to publish the current project in self contained mode, using the Release Configuration (Debug vs Release), targeting linux-64 runtime.

Once this command completes, you will have a linux-x64 folder in your bin/Release folder which contains your application.

How do I find publish runtimes?

If you want to publish your app for use on other systems such as Windows, Mac and Linux you will need to update the Runtime Identifier (RID). You can find the list of Runtime Identifiers at the Microsoft Runtime Identifier (RID) Catalog. This catalog only contains the most used RIDs. You can find the complete list in the dotnet repository



Leave a Reply

Your email address will not be published. Required fields are marked *