本文介绍了msbuild不尊重.sln文件设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的VC ++ 2015项目中,我有两个平台配置,用于解决方案文件的Win32和x64

in my VC++ 2015 project, I have two platform configuration, Win32 and x64 for the solution file

MyProject.sln包含多个可以为Platform Win32和x64构建的项目

MyProject.sln contains multiples projects that able to build for Platform Win32 and x64

我有特定的项目构建,请在x64的Configuration Manager中取消选中

I have specific project build is uncheck in Configuration Manager for x64

例如,MyProject.sln包含Project1和Project2,仅Project1将同时构建Win32和x64平台,Project2将仅针对Win32构建

For example, MyProject.sln contains Project1 and Project2, only Project1 will have both Platform Win32 and x64 going to build, Project2 will only build for Win32

msbuild "MyProject.sln" /p:platform=Win32 /p:configuration=Debug /t:rebuild // this work

msbuild "MyProject.sln" /p:platform=x64 /p:configuration=Debug /t:rebuild // this doesn't work

msbuild也会尝试构建Project2,但是由于找不到依赖库而失败,实际上,我希望它从构建中排除Project2,但是msbuild不尊重.sln设置

msbuild will try to build Project2 as well, but it will failed due to the dependend lib is not found, in fact, i want it to exclude Project2 from build, but somehow msbuild does not respect the .sln settings

我在记事本中打开MyProject.sln,并注意到显然Project2不包含在x64版本中

i open up MyProject.sln in notepad and notice it is clearly Project2 not include in x64 build

在使用msbuild时是否要在Platform x64中排除Project2构建?通过VS2015 IDE进行构建没有问题,因为我已经从构建中取消选中了Configuration Manager.

anyway to exclude the Project2 build in Platform x64 when using msbuild? build through VS2015 IDE has no issue because the Configuration Manager I have uncheck it from build.

推荐答案

@hghew,像这样,请添加一个解决方案平台"Win32",如以下屏幕截图所示.

@hghew, Like this case, please add a solution platform "Win32" like the following screen shot.

这篇关于msbuild不尊重.sln文件设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-27 23:45