Get the App
SLTechnology News&Howtos  ›  Development  › 

The method of .NET Core issuing applications through dotnet publish Command

Shulou Source: shulou.com Published: 2022-06-01 03:14:43 10月01日 Update

This article mainly introduces the relevant knowledge of ".NET Core publishes applications through dotnet publish commands". The editor shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article on ".NET Core publishing applications through dotnet publish commands" can help you solve the problem.

I. Preface

A new feature has been added in .NET Core 3.0: Publishing Single EXEs, which can publish the entire .net core application as an executable file through the dotnet publish command.

II. Preparatory work

Create a new MVC project using VS 2019:

Then use the dotnet publish command to publish:

Dotnet publish

As shown in the following figure:

Let's check the released file.

You can see that there are many files after the release. Next we release it as a single executable file.

1. Publish commands on Windows

Execute the following release command on the Windows system

Dotnet publish-r win10-x64 / p:PublishSingleFile=true

As shown in the following figure:

We are looking at the released file

As you can see: only one exe file is generated this time, and the file size is about 86m. Double-click the exe file to run the program:

2. Publish commands on Mac

Execute the following publish command on the Mac system:

Dotnet publish-r osx-x64 / p:PublishSingleFile=true

As shown in the figure:

The published file is shown in the following figure:

3. Publish commands on Linux

Execute the following publish command on the Linux system:

Dotnet publish-r linux-x64 / p:PublishSingleFile=true

As shown in the figure:

The published file is shown in the following figure:

Upload to the Linux system and run.

This is the end of the introduction to "how .NET Core publishes applications through dotnet publish commands". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Tags: Commands files methods applications systems knowledge industries such as figure run different practical next content preface single can be passed size practicality actual article Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Apple NVidia macOS vpn