Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

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

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

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.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report