明确设置目标平台时不会构建新项目
我使用一个项目创建一个新的解决方案,然后将目标平台从“任何 CPU”更改为“x86”。此后添加的新项目不会默认构建,并且它们的目标平台不遵循全局设置。为什么?!
查看配置管理器,添加的新项目未选中“构建”,并且它们获得目标平台“任何 CPU”而不是全局设置的 x86。为什么会发生这种情况?我希望新项目也能够获得全局设置和定义的 x86 目标平台。我尝试过的一些操作:
- 将全局平台切换回任何 CPU,然后再次切换到 x86。没有变化。
- 为新项目明确选择平台。 x86 在列表中不可用,当我说
并尝试添加它时,我不允许“.. 已经有同名的解决方案平台存在。”。 - 在新项目的构建属性中,我无法在“配置”部分中更改平台,但可以在“常规”部分中将“平台目标”设置为 x86。然而,尚不清楚这是否真的会产生影响,并且如果我稍后在全球范围内更改目标平台,它也不会响应。
最初我认为这是将我的解决方案从 VS2008 转换为 VS2010 时出现的问题,但问题适用于这两个地方。即,当我在 VS2008 中创建解决方案并留在 VS2008 中时,我仍然遇到问题。
I create a new solution with one project, and then change the target platform from "Any CPU" to "x86". After this new projects added doesn't get built by default, and their target platform doesn't follow the global settings. Why?!
Looking at the configuration manager new projects added are not checked to "Build", and they get target platform "Any CPU" instead of the globally set x86. Why is this happening? I expect new projects too to get the globally set and defined x86 target platform.. Some things I've tried:
- Toggle global platform back to Any CPU, and then to x86 again. No change..
- Choosing platform explicitly for the new project. x86 is not available in the list, and when I say
<New..>
and try adding it I'm not allowed as ".. a solution platform with the same name already exists.". - On the build properties for the new project I can't change the platform in the Configuration section, but I can set "Platform target" to x86 in the General section. It is however not clear whether this actually makes a difference, and it wouldn't respond if I change the target platform globally later.
Initially I thought this was a problem from converting my solution from VS2008 to VS2010, but the problem applies both places. I.e. when I create a solution in VS2008 and just stay in VS2008 I still get the problem.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,这几乎是 VS2010 中的一个重大变化,而且有点混乱。 2010 年创建的新解决方案将有两种配置:“Debug|x86”和“Release|x86”。与以前版本创建的解决方案不同,“调试|任何CPU”和“发布|任何CPU”是默认值。
然后,当您将在先前版本中创建的现有项目添加到此 VS2010 创建的解决方案中时,您将得到一个令人讨厌的混合包。平台组合现在显示三个选项:“x86”、“任何CPU”和“混合平台”。后者将建设所有项目。另外非常令人困惑的是配置名称实际上并不直接影响平台目标设置。
它是可以修复的,您可以使用文本编辑器在 .sln 和 .vcproj 文件中搜索“Any CPU”并将其替换为“x86”。最好的方法也许是避免麻烦,让 VS2010 转换 VS2008 解决方案,而不是创建一个新的解决方案。令人讨厌的问题。
Yes, this is a very nearly breaking change in VS2010 and a bit of a mess. New solutions created in 2010 will have two configurations, "Debug|x86" and "Release|x86". Which is different from solutions created by previous versions, "Debug|Any CPU" and "Release|Any CPU" were the defaults.
When you then add an existing project created in a previous version to this VS2010 created solution, you'll get a nasty mixed bag. The platform combo now shows three options, "x86", "Any CPU" and "Mixed platforms". The latter will build all projects. What is also very confuzzling is that the configuration name actually doesn't directly affect the Platform Target setting.
It is fixable, you can search and replace "Any CPU" with "x86" in the .sln and .vcproj files with a text editor. Best approach perhaps is to stay out of trouble and let VS2010 convert a VS2008 solution instead of creating a new one. Yucky problem.
步骤:
Steps: