Azure Pipeline 中 .NetCore、VisualStudio 构建和 MSBuild 任务之间的区别? [英] Difference between .NetCore, VisualStudio build and MSBuild task in Azure Pipeline?
问题描述
我正在为我的 .Net Core 项目创建一个新的 CI Azure Pipeline.在 Azure Pipeline 中,Microsoft 提供了三个构建任务,即 .Net Core、Visual Studio Build 和 MSBuild.
I'm creating a new CI Azure Pipeline for my .Net Core projects. In Azure pipeline, Microsoft has provided three task for build i.e., .Net Core, Visual Studio Build and MSBuild.
既然这三个任务都执行构建操作,我们是否有任何特定标准来选择一项任务而不是另一项任务?
Since all three task does build operation, do we have any specific criteria to choose one task over another?
我已经阅读了 Microsoft 提供的文档,但找不到关于此的详细信息.
I've gone through the documentation provided by Microsoft but I couldn't find much detail on this.
编辑注意:我知道 Visual Studio 构建任务有一个版本控制子任务,但这也可以通过单独的自定义任务来实现.
Edit Note: I'm aware that Visual Studio build task has a versioning sub task, but this can be achieved by separate custom task as well.
推荐答案
Azure Pipeline 中 .NetCore、VisualStudio 构建和 MSBuild 任务之间的区别?
Difference between .NetCore, VisualStudio build and MSBuild task in Azure Pipeline?
我们知道,dotnet
建立在 msbuild
之上,我们可以使用 dotnet CLI 调用
msbuild 任务
代码>.
As we know, dotnet
is built on top of msbuild
, we could call msbuild tasks
by using the dotnet CLI
.
这就是为什么您可以使用 MSBuild task
或 .Net Core task
来构建您的项目/解决方案的原因.
That is the reason why you can use MSBuild task
or .Net Core task
to build your project/solution.
当然,dotnet
有一些 msbuild
没有的功能,比如 dotnet new
.在这一点上,dotnet
比 msbuild
更容易使用.
Assuredly, dotnet
has some features that aren't in msbuild
, like dotnet new
. At this point, dotnet
is easier to use than msbuild
.
但是,如果我们构建一些 .net
项目(不是 .net core
),我们只需要使用 MSBuild task
而不是 >.NET Core 任务
.因为我们不需要安装不必要的dotnet SDK
.
But, if we build some .net
projects (not .net core
), we just need use MSBuild task
instead of .NET Core task
. Because we do not need install unnecessary dotnet SDK
.
所以,当我们在没有特殊需求的情况下构建项目/解决方案时,.net core task
和 msbuild task
只是一个品味问题.
So, when we building the project/solution without special needs, the .net core task
and the msbuild task
are just a matter of taste.
另一方面,MSBuild
是 Visual Studio 的一部分,当我们用 Visual Studio 构建项目/解决方案时,它会调用 MSBuild
来执行一些构建任务完成构建项目/解决方案.
On the other hand, MSBuild
is part of Visual Studio, when we build the project/solution with Visual Studio, it will invoke the MSBuild
to execute some build task to complete the build project/solution.
有时我们不想在我们的构建服务器上安装完整的 Visual Studio 只是为了构建我们的项目/解决方案,在这种情况下,我们可以使用 MSBuild 任务
来构建项目/解决方案服务器,而不是安装完整的 Visual Studio.
Sometimes we do not want to install the full Visual Studio on our build server just to build our project/solution, in this case, we could use the MSBuild task
to build the project/solution on the server instead of installing the full Visual Studio.
所以简而言之,dotnet
建立在 msbuild
之上,而 MSBuild
是 Visual Studio 的一部分,这就是为什么你可以使用 MSBuild 和 Visual Studio 构建 .net core 项目.
So in a nutshell, dotnet
is built on top of msbuild
and MSBuild
is part of Visual Studio, that is the reason why you can use MSBuild and Visual Studio to build .net core project.
检查这个线程更多详情.
希望这会有所帮助.
这篇关于Azure Pipeline 中 .NetCore、VisualStudio 构建和 MSBuild 任务之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!