Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 627
R.Sharma Avatar asked May 16 '19 10:05

R.Sharma


1 Answers

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.

like image 122
Leo Liu-MSFT Avatar answered Sep 21 '22 20:09

Leo Liu-MSFT