Visual Studio会将哪些参数传递给MSBuild? [英] What parameters does Visual Studio pass to MSBuild?

查看:68
本文介绍了Visual Studio会将哪些参数传递给MSBuild?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio运行构建时,它将运行MSBuild来完成大部分工作.如果将.sln文件传递到具有适当的Configuration和Platform属性的MSBuild,它将以类似于Visual Studio的方式构建您的解决方案.

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

但是,有 区别:有时,构建会通过MSBuild而不是Visual Studio出错,反之亦然.

Visual Studio会将哪些参数传递给MSBuild以影响该过程?有什么方法可以查看执行构建时传递的参数?

解决方案

Visual Studio不会执行MSBuild.exe,而是托管构建引擎本身(通过Microsoft.Build.*程序集)-至少对于这种情况默认的C#项目系统.其他语言,插件,程序包等可能会有所不同.

实际上,Microsoft博客上有一篇有关此的系列文章,我正在尝试查找它们并更新此答案.

UPDATE :再次找到它.在此处中查找"MSBuild in Visual Studio"帖子. /p>

关于您的原始问题,页可能会为您提供进一步的帮助.您也可以转到工具",选项",项目和解决方案",构建和运行",并增加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?

解决方案

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.

这篇关于Visual Studio会将哪些参数传递给MSBuild?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆