问题描述
我有一些针对 .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:
- myFolderetstandard2.0"
- myFolderetcoreapp2.1"
- "myFolderetstandard2.0"
- "myFolderetcoreapp2.1"
我使用dotnet build"得到相同的结果命令.现在我需要我的控制台应用程序的 EXE 文件.所以我使用dotnet publish -c Release -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.
现在我得到了这个新目录,myFolderetcoreapp2.1win-x64",在那里我可以找到所有的 DLL 文件和控制台应用程序的 EXE 文件.
Now I get this new directory, "myFolderetcoreapp2.1win-x64", where I find all DLL files and the console application's EXE file.
还不够!
我又找到了一个目录myFolderetcoreapp2.1win-x64publish",在这里我又找到了所有 DLL 文件和控制台应用程序的 EXE 文件.
I find one directory more, "myFolderetcoreapp2.1win-x64publish", 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
指定输出目录的路径.如果未指定,则默认为 ./bin/[configuration]/[framework]/publish/用于依赖于框架的部署或 ./bin/[configuration]/[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"命令是如何工作的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!