4

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?

  • Visual Studio uses MSBuild managed API to perform the tasks, so you won't capture the commands. For .NET Core projects, use `dotnet`. – Lex Li Dec 08 '17 at 17:22
  • 2
    Possible duplicate of [What parameters does Visual Studio pass to MSBuild?](https://stackoverflow.com/questions/11932164/what-parameters-does-visual-studio-pass-to-msbuild) – Christian.K Dec 17 '17 at 16:10

2 Answers2

3

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.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
1

I hope those link and link helped you somehow, they are old but may give you some guidance to the solution you are lookin for.