c#-Visual Studio 2010 $(PlatformName)宏与MSBuild.exe不兼容

我在Visual Studio 2010中有一个C#项目,它在预生成事件命令行中与此相关:

echo "$(Configuration)" - "$(PlatformName)" - "$(Platform)"
exit 1

结果是:

"Debug" - "AnyCPU" - "AnyCPU"

即使该窗口的宏部分建议在这种情况下PlatformName应该显示为Any CPU(带空格):http://i.imgur.com/xb3Y8.png(即使MSDN似乎暗示http://msdn.microsoft.com/en-us/library/42x5kfw4.aspx没有空间).

msbuild /property:Configuration="Debug" /property:Platform="AnyCPU"
1>MyProgram.sln.metaproj : error MSB4126: The specified solution configuration "Debug|AnyCPU" is invalid.

这里发生了什么?不幸的是,“ AnyCPU”不是命令行上的有效平台,因此我无法继续.上面的代码在/ property:Platform =“ Any CPU”(带空格)下可以正常工作.

是否有我可以使用的另一个宏,还是MSBuild可以接受该平台的标志?

解决方法:

您似乎已经达到了MSBuild bug 503935

报告:

The msbuild Platform property has a different value for Any CPU
depending upon whether you are building the solution or building a
project.

Solution use Platform=”Any CPU” – space

Project use Platform=”AnyCPU” – no space

响应:

Posted by Microsoft on 11/2/2009 at 7:22 PM

Thanks for taking the time to send us your feedback.

Unfortunatley, having just shipped Beta 2, it is too late in the cycle
to make adjustments at this point. It makes perfect sense that we
should make these two the same. Looks like we should use “AnyCPU”
consistently for both. We also need to make sure that we are backward
compatible, so we will have to take this in consideration.

In the next round, we hope to be doing work around the solution, and
we can perhaps fix this during that cycle. For this cycle, I am
resolving this bug as “Won’t Fix”.

Thanks,

Chuck England

Visual Studio Platform Program Manager – MSBuild

最终决议:

Closed as Won’t Fix

上一篇:c#-PartialClassGenerationTask和MarkupCompilePass1如何一起工作/属于


下一篇:c#-多目标.NET程序集在.NET 4.5和.NET 4上使用async / await