R.Sharma
R.Sharma

Reputation: 243

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://learn.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.

Upvotes: 24

Views: 10373

Answers (3)

Chris F Carroll
Chris F Carroll

Reputation: 12370

nb the VSBuild task will only run on a Windows agent machine, so if you want builds to run on linux then the DotNetCoreCLI task is your simplest option.

Upvotes: 0

batunal
batunal

Reputation: 51

Being not so rigorous, I can say that dotnet contains msbuild, and msbuild contains nuget. So as you can pack packages with msbuild, you can also build projects with dotnet.

Upvotes: 1

Leo Liu
Leo Liu

Reputation: 76770

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.

Upvotes: 29

Related Questions