Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What parameters does Visual Studio pass to MSBuild?

When Visual Studio runs a build, it runs MSBuild to do the majority of the work. If you pass the .sln file to MSBuild, with appropriate Configuration and Platform properties, it will build your solution similarly to how Visual Studio would.

msbuild mysolution.sln /p:Configuration=Release /p:Platform="Any CPU" 

However, there are differences: sometimes a build will error through MSBuild and not through Visual Studio, or vice-versa.

What parameters does Visual Studio pass into MSBuild to influence the process? Is there some way to see the parameters it's passing as a build is is executed?

like image 844
Paul Turner Avatar asked Aug 13 '12 10:08

Paul Turner


People also ask

What MSBuild command does Visual Studio use?

Visual Studio uses MSBuild to load and build managed projects. The project files in Visual Studio (. csproj, . vbproj, .

Does Visual Studio 2019 use MSBuild?

If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2019 and later, it's installed under the Visual Studio installation folder. For a typical default installation on Windows 10, MSBuild.exe is under the installation folder in MSBuild\Current\Bin.

What is the difference between MSBuild and Visual Studio build?

Visual Studio determines the build order and calls into MSBuild separately (as needed), all completely under Visual Studio's control. Another difference arises when MSBuild is invoked with a solution file, MSBuild parses the solution file, creates a standard XML input file, evaluates it, and executes it as a project.

How do I set properties in MSBuild?

MSBuild lets you set properties on the command line by using the -property (or -p) switch. These global property values override property values that are set in the project file. This includes environment properties, but does not include reserved properties, which cannot be changed.


1 Answers

Visual Studio does not execute MSBuild.exe, but hosts the build engine itself (by means of the Microsoft.Build.* assemblies) - at least that is the case for the default C# project system. Other languages, addins, packages, etc. might do it differently.

Actually, there was a post series on the Microsoft blogs about this, I'm trying to find them and update this answer.

UPDATE: Found it again. Look for the "MSBuild in Visual Studio" posts here.

Concerning your original question, this page might help you further. Also you could go to "Tools", "Options", "Projects and Solutions", "Build and Run" and increase the MSBuild output verbosity. With "Diagnostic" you should basically see every property that is set upon starting the build.

like image 111
Christian.K Avatar answered Oct 12 '22 03:10

Christian.K