Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I view what build commands are actually executed with MSBuild?

I use MSBuild to build the project file. By default, MSBuild just prints out the compilation results, but I need to check what commands are being executed.

Can I view what build commands are actually executed? I want to check the compiler options and references are used with csc command.

like image 440
prosseek Avatar asked Jun 16 '11 14:06

prosseek


People also ask

How do I check MSBuild?

If you have Visual Studio, then you already have MSBuild installed. With Visual Studio 2022, 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 find build command in Visual Studio?

To compile source files from within the Visual Studio IDE, choose the Build command from the Build menu. When you build project files by using the Visual Studio IDE, you can display information about the associated vbc command and its switches in the output window.

Does Visual Studio call MSBuild?

Visual Studio uses MSBuild, but MSBuild doesn't depend on Visual Studio. By invoking msbuild.exe or dotnet build on your project or solution file, you can orchestrate and build products in environments where Visual Studio isn't installed. Visual Studio uses MSBuild to load and build managed projects.


2 Answers

You can use the /v[erbosity] flag. I don't know that you can get a list of the flags passed to CSC, but if you use /v:Detailed or /v:diagnostic it will dump a ton of information about the targets being executed, all the MSBuild variables and their values, and all of the resolved reference assemblies.

[edit:] if you hunt for it, it looks like it will show you the command line call to csc.exe as well, even on /v:detailed.

like image 59
Jimmy Avatar answered Sep 20 '22 10:09

Jimmy


You can set the output of a Visual Studio build to be detailed. Go to menu Tools -> Options -> Projects and Solutions -> Build and Run. Change the MSBuild project build output verbosity option, typically from the default Minimal to Normal, Detailed or Diagnostic.

like image 27
Zain Ali Avatar answered Sep 19 '22 10:09

Zain Ali