.NET Core-'dotnet publish'命令如何工作? [英] .NET Core - how does the 'dotnet publish' command work?

查看:568
本文介绍了.NET Core-'dotnet publish'命令如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个针对.NET Standard 2.0的项目和针对.NET Core 2.1的控制台应用程序项目的解决方案.

I have a solution with some projects targeting .NET Standard 2.0 and a console application project targeting .NET Core 2.1.

我将"myFolder"设置为作为输出文件夹. 从Visual Studio构建,我在以下位置获得了所有DLL文件:

I set "myFolder" as the output folder. Building from Visual Studio, I get all DLL files in:

  • "myFolder \ netstandard2.0"
  • "myFolder \ netcoreapp2.1"

我使用"dotnet build"获得了相同的结果.命令. 现在,我需要控制台应用程序的EXE文件. 因此,我使用"dotnet发布-c版本-r win-x64 MySolution.sln"命令.

I get the same using the "dotnet build" command. Now I need my console application's EXE file. So I use the "dotnet publish -c Release -r win-x64 MySolution.sln" command.

现在,我得到了这个新目录"myFolder \ netcoreapp2.1 \ win-x64",在其中可以找到所有DLL文件和控制台应用程序的EXE文件.

Now I get this new directory, "myFolder\netcoreapp2.1\win-x64", where I find all DLL files and the console application's EXE file.

不够!

我再找到一个目录"myFolder \ netcoreapp2.1 \ win-x64 \ publish",在这里我再次找到所有DLL文件和控制台应用程序的EXE文件.

I find one directory more, "myFolder\netcoreapp2.1\win-x64\publish", where I find again all DLL files and the console application's EXE file.

它们有什么意思?我阅读了命令文档,但是我没有找到答案.

Which meaning do they have? I read the command documentation, but I didn't find my answer.

推荐答案

根据文档

-o|--output <OUTPUT_DIRECTORY>

指定输出目录的路径.如果未指定,则默认为./bin/[配置]/[框架]/publish/(对于依赖框架的部署)或./bin/[配置]/[framework]/[runtime]/publish/(对于自定义)包含部署.

Specifies the path for the output directory. If not specified, it defaults to ./bin/[configuration]/[framework]/publish/ for a framework-dependent deployment or ./bin/[configuration]/[framework]/[runtime]/publish/ for a self-contained deployment.

dotnet publish -c Release -r win-x64 --output ./MyTargetFolder MySolution.sln

这篇关于.NET Core-'dotnet publish'命令如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆