What is responsible for project build?

Topics: General
Dec 24, 2013 at 2:56 PM
I use Visual Studio 2013 to build project. I think that Visual Studio uses MSBuild to load and build managed projects. The project files in Visual Studio (.csproj,.vbproj, vcxproj, and others) contain MSBuild XML code that executes when you build a project by using the IDE.
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
However when you open the NuGet.targets file, you can see the code:
<UsingTask TaskName="DownloadNuGet" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
What is the purpose to put MSBuild in NuGet.targets?
So which one is responsible for the build?
Dec 25, 2013 at 3:04 AM
The purpose of NuGet.targets is to hook NuGet related operations (such as package restore) into MSBuild process (such as project build).

The <UsingTask> tag is used to allow we define an inline task using C# source code, http://msdn.microsoft.com/en-us/library/dd723643(v=vs.100).aspx. It is normal to see such references to MSBuild assemblies if you check out other targets files.

You might read books such as http://www.amazon.com/Inside-Microsoft-Build-Engine-Foundation/dp/B00B9ZEKH4 to better understand MSBuild related topics.