什么是默认的MSBuild平台 [英] What is default msbuild platform

查看:163
本文介绍了什么是默认的MSBuild平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果未指定msbuild,如何选择平台?在我看来,对于某些解决方案,它为其他"x86"选择了混合平台".

How does msbuild chose a platform if it is not specified? It seems to me that for some solutions it selects "Mixed Platforms" for others "x86".

我打开了日志记录的诊断级别,我唯一看到的是开头的初始属性"包含例如平台=混合平台",没有任何解释.

I switch on the diagnostics level of logging and the only thing I can see is that "Initial Properties" at the beginning contain e.g. "Platform = Mixed Platforms" without any explanation why.

要抢占一些答案,我知道我可以手动覆盖平台.那不是问题.我需要知道未指定msbuild的功能.

To preempt some answers, I know that I can override the platform manually. That is not an issue. I need to know what msbuild does when it is NOT specified.

推荐答案

这可能会有所帮助:我正在研究此问题,最后通过查看Microsoft.Cpp.Default.props(在此Visual版本的第21行中)跟踪了默认的安装平台. Studio),它位于Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120:

This may help: I was researching this and finally tracked down the default platform for my install, by looking in Microsoft.Cpp.Default.props (line 21 in this version of Visual Studio), which lives in Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120:

<Platform Condition="'$(Platform)' == ''">Win32</Platform>

这意味着在VS12(Visual Studio 2013)下,如果未明确指定其他平台,MSBuild将选择Win32作为平台.如其他一些问题所述,设置名为Platform的环境变量会将默认值更改为您设置的值.

This means that under VS12 (Visual Studio 2013) MSBuild will pick Win32 as the platform if no other platform is explicitly specified. As noted in some other questions, setting an environment variable named Platform will change the default to the value you set.

重要说明:如果您在Visual Studio解决方案文件(* .sln)而不是项目文件上调用MSBuild,并且未在MSBuild参数中指定平台,则会显示该平台MSBuild将根据解决方案文件中SolutionConfigurationPlatforms全局部分下的第一个条目自动选择平台.我没有在任何地方找到此文档,但从实验来看似乎是事实.这意味着,编辑项目文件并提供其他默认的Platform属性(如上所述)后,MSBuild将忽略此默认设置,因为它甚至在开始查看项目之前就已经选择了平台.直接在项目文件上调用MSBuild似乎会绕过此行为.

Important note: If you invoke MSBuild on a Visual Studio solution file (*.sln) rather than a project file, and you don't specify a platform in the MSBuild arguments, then it appears that MSBuild will choose the platform automatically based on the first entry under the SolutionConfigurationPlatforms global section in the solution file. I haven't found this documented anywhere but from experimentation it appears to be the case. This means that editing your project file and providing a different default Platform property (as described above), MSBuild will ignore this default, because it will have chosen the platform already before it even starts looking at the project. Invoking MSBuild directly on the project file seems to bypass this behavior.

这篇关于什么是默认的MSBuild平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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