Azure管道中的.NetCore,VisualStudio构建和MSBuild任务之间的区别? [英] Difference between .NetCore, VisualStudio build and MSBuild task in Azure Pipeline?

查看:114
本文介绍了Azure管道中的.NetCore,VisualStudio构建和MSBuild任务之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为.Net Core项目创建一个新的CI Azure管道.在Azure管道中,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.

https://docs.microsoft.com/zh-CN/azure/devops/pipelines/tasks/build/visual-studio-build?view=azure-devops

修改 注意:我知道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管道中的.NetCore,VisualStudio构建和MSBuild任务之间的区别?

Difference between .NetCore, VisualStudio build and MSBuild task in Azure Pipeline?

我们知道,dotnet建立在msbuild之上,我们可以使用dotnet CLI来调用msbuild tasks.

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.此时,dotnetmsbuild更易于使用.

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 task.因为我们不需要安装不必要的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 taskmsbuild 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 task在服务器上构建项目/解决方案,而不是安装完整的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核心项目的原因.

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管道中的.NetCore,VisualStudio构建和MSBuild任务之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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