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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With