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

wes*_*wes 4 c# msbuild visual-studio-2010 pre-build-event

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

echo "$(Configuration)" - "$(PlatformName)" - "$(Platform)"
exit 1
Run Code Online (Sandbox Code Playgroud)

结果是:

"Debug" - "AnyCPU" - "AnyCPU"
Run Code Online (Sandbox Code Playgroud)

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

msbuild /property:Configuration="Debug" /property:Platform="AnyCPU"
1>MyProgram.sln.metaproj : error MSB4126: The specified solution configuration "Debug|AnyCPU" is invalid.
Run Code Online (Sandbox Code Playgroud)

这里发生了什么?不幸的是,"AnyCPU"它不是命令行上的有效平台,因此我无法继续。上面的工作原理很好/property:Platform="Any CPU"(带有空格)。

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

Mat*_*son 5

您好像遇到了MSBuild错误503935

报告:

对于任何CPU,msbuild Platform属性的值都不同,这取决于您是构建解决方案还是构建项目。

解决方案使用Platform =“ Any CPU”-空间

项目使用Platform =“ AnyCPU”-没有空间

响应:

由Microsoft发布于11/2 / 2009,7:22 PM

感谢您抽出宝贵的时间向我们发送反馈。

Unfortunatley刚发布了Beta 2,现在在周期中为时已晚,无法进行调整。我们应该使这两个相同完全有道理。看起来我们应该一致地对两者使用“ AnyCPU”。我们还需要确保我们向后兼容,因此我们必须考虑这一点。

在下一轮中,我们希望围绕解决方案开展工作,也许我们可以在此周期内解决此问题。对于此周期,我将此错误解决为“无法修复”。

谢谢,

查克英格兰

Visual Studio平台程序管理器-MSBuild

最终决议:

由于无法修复而关闭