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

爷,独闯天下 提交于 2020-07-18 18:01:31

问题


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?

I've gone through the documentation provided by Microsoft but I couldn't find much detail on this.

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

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.


回答1:


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

As we know, dotnet is built on top of msbuild, we could call msbuild tasks by using the dotnet CLI.

That is the reason why you can use MSBuild task or .Net Core task to build your project/solution.

Assuredly, dotnet has some features that aren't in msbuild, like dotnet new. At this point, dotnet is easier to use than msbuild.

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.

So, when we building the project/solution without special needs, the .net core task and the msbuild task are just a matter of taste.

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.

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.

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.

Check this thread for some more details.

Hope this helps.



来源:https://stackoverflow.com/questions/56166335/difference-between-netcore-visualstudio-build-and-msbuild-task-in-azure-pipeli

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!