Вопрос

I have a C# project in Visual Studio 2010 with this in the pre-build event command line:

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

and the results are:

"Debug" - "AnyCPU" - "AnyCPU"

even though the macro section of that window suggests that PlatformName should appear as Any CPU in this case (with a space): http://i.imgur.com/xb3Y8.png (even though MSDN seems to suggest that there is no space at 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.

What's going on here? Unfortunately, "AnyCPU" is not a valid platform on the command line, so I am unable to proceed. The above works just fine with /property:Platform="Any CPU" (with a space).

Is there another macro I can use, or some flag for MSBuild to accept the platform anyway?

Это было полезно?

Решение

It looks like you've hit MSBuild bug 503935:

Report:

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

Response:

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

Final Resolution:

Closed as Won't Fix

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top