Reputation: 4155
I've started getting the following error when attempting to run MSBuild via batch file on my machine.
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\AppxPackage\Microsoft.AppXPackage.Targets(283,22): error MSB4086: A numeric comparison was attempted on "10.0.11000.0" that evaluates to "10.0.11000.0" instead of a number, in condition "'$(TargetPlatformVersion)' >= '10.0.11000.0'". [MyProject.csproj]
This happens on several different projects within the solution.
I'm currently running VS2015 (Update 3). I updated from Update 2 on Friday. So it's possible that this could be related.
Based on various posts online (such as this one) it appears to have been (at some point in the past at least) caused by Resharper. However, I have updated Resharper to the latest version, and run a repair on the install, to no avail. I've even attempted to suspend it within Visual Studio itself.
I've also attempted to repair the VS215 installation itself. But am still getting the error.
How do I solve this error?
Update
So When I run this batch file, it's running using VisualStudioVersion=12.0
. This appears to be part of the issue. When I repoint it at 12.0
the build runs fine.
Checking into the targets file thats throwing the exception, you can see this on line 283:
<PropertyGroup>
<SdkIsRS1OrLater>False</SdkIsRS1OrLater>
<SdkIsRS1OrLater
Condition="'$(TargetPlatformVersion)' >= '10.0.11000.0'">True</SdkIsRS1OrLater>
</PropertyGroup>
So I'm not entirely sure why this is the case, but it appears to be an issue in the targets file from MS?
Upvotes: 7
Views: 4930
Reputation: 2367
I was getting the same error when we did the build in Teamcity. I got it working after changing the teamcity build step configuration to use MSBuild Tools 2015 for MSBuild version and 14.0 as MSBuild tools version.
Upvotes: 1
Reputation: 176
Try setting the path and environment variables using the batch file shipped with VS2015 rather than setting the msbuild path and 'VisualStudioVersion' manually, to do this add the following to your batch file:
call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
I'm not sure what the root cause is, I suspect a mismatch of MSBuild and target file versions.
See https://msdn.microsoft.com/en-us/library/f2ccy3wt.aspx for more info on the batch file above.
Upvotes: 3
Reputation: 3454
Yes, I suspect the same - seems that someone did a replace and put >
sign instead of >
.
I found 3 entries of >
in that file in places where it logically must be >
PS: This is not an answer, comments don't support chars screening
The italic text above was a bit too fast, I thought that I caught the issue with a smoking gun, but re-checking the code inside that .targets file shows that >
is used correctly in the condition - one has to encode these signs as per
MSBuild Conditions, although it's still not clear why it's trying to compare strings with '>='.
Using it in other 2 cases makes less sense. Anyway, I suspect you're right and this is a problem with a specific targets file.
Upvotes: 0