Does Visual Studio use MSBuild internally, and what is the exact command? [duplicate]

那年仲夏 提交于 2020-01-03 15:16:08

问题


Does Visual Studio (specifically VS2013) use msbuild internally to build projects?

And if so, is there a way for me to determine the exact command and arguments it uses? (And by this I mean the MSBuild command, not the individual commands that MSBuild would be calling)

My goal is to successfully build a certain projects (it is a xamarin project) using msbuild, so that later I can use my Windows-based teamcity build agent to build xamarin projects.


回答1:


"VS uses the same MSBuild object model that is documented on MSDN"

http://blogs.msdn.com/b/msbuild/archive/2006/01/06/508981.aspx

It appears that the MSBuild command line options are not specified, but rather the MSBuild APIs are called within Visual Studio. Unless you have the Visual Studio source code to reverse engineer, you cannot get an equivalent command line.




回答2:


Visual Studio uses msbuild.exe but it is done in an unusual way. It feeds it with build commands that are not visible at all, most likely through input/output redirection. You'll need to make-do with the common wisdom of how msbuild is executed. You use a command line like this:

   msbuild.exe yadayada.sln /t:build /p:platform=AnyCpu /p:configuration=Release

Where yadayada.sln can both be a solution file if you want to build the entire solution or an individual project file. The /t argument can also be clean or rebuild. Pick the platform and configuration that are appropriate for the solution, as visible through the VS Build + Configuration Manager dialog.

Do note that build agents like TeamCity have pre-cooked scripts so you don't have to figure this out for yourself. The MSBuild doc page is here.




回答3:


Look at the build output window in Visual Studio. You may need to tweak the verbosity level in Settings, but it should show you the exact commands it is running in order to build the project.



来源:https://stackoverflow.com/questions/22083768/does-visual-studio-use-msbuild-internally-and-what-is-the-exact-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!