How to find out the command Visual Studio sends to MSBuild?

I'm trying to use MSBuild in a CI/CD engine, and I need to publish an ASP.NET Core MVC application using it.

I want to know what Visual Studio sends to the MSBuild when we build/publish a project, and send that exactly to MSBuild.

Is there anyway that we can find out the command Visual Studio 2017 sends to MSBuild to build/publish a .NET Core project?

Update: To those who say that VS uses MSBuild API, simply kill all MSBuild.exe processes, then build a project/solution via VS, and you'll see that MSBuild.exe is coming back into the processes list (viewed via Task Manager). So, what's the explanation? If VS uses API, then that API should run inside devenv.exe process and no instance of MSBuild.exe should appear inside Task Manager. Right?

Update 2: Does devenv.exe expose its publish functionality?

Upvotes: 4

Views: 3050

Answers (1)

Leo Liu
Leo Liu

Reputation: 76910

Is there anyway that we can find out the command Visual Studio 2017 sends to MSBuild to build/publish a .NET Core project?

No, you can not find out the command Visual Studio 2017 sends to MSBuild to build/publish a .NET Core project. Because Visual Studio uses MSBuild API to execute a series of tasks to accomplish build/publish:

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. Visual Studio projects import all the necessary settings and build processes to do typical development work, but you can extend or modify them from within Visual Studio or by using an XML editor.

So there is no command sends to MSBuild, we won't capture the commands. You can check the build log after change MSBuild output verbosity to "Diagnostic" or "Detailed" to verify the existence of the command line.

Upvotes: 3

Related Questions