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

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

问题描述

当 Visual Studio 运行构建时,它会运行 MSBuild 来完成大部分工作.如果您将 .sln 文件传递​​给 MSBuild,并带有适当的配置和平台属性,它将以类似于 Visual Studio 的方式构建您的解决方案.

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"

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

However, there are differences: sometimes a build will error through MSBuild and not through Visual Studio, or vice-versa.

Visual Studio 将哪些参数传递给 MSBuild 以影响流程?有没有办法查看它在执行构建时传递的参数?

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

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.

更新:又找到了.查找Visual Studio 中的 MSBuild".发布 这里.

UPDATE: Found it again. Look for the "MSBuild in Visual Studio" posts here.

关于您最初的问题,页面可能会进一步帮助您.您也可以转到工具"、选项"、项目和解决方案"、构建和运行".并增加 MSBuild 输出的详细程度.用诊断"您基本上应该会看到在开始构建时设置的每个属性.

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天全站免登陆