Project load error for some projects targeting .Net 4.6 in VS2013

I have a solution with a number of C # projects targeting .Net 4.6 and one native C ++ project (no CLR). After using the solution with VS2015, I now get errors when trying to open the solution in VS2013 when half of the projects are not loading.

My own C ++ project and some of the C # projects give the error:

error: A numeric comparison was made to "$ (TargetPlatformVersion)", which evaluates to "10.0.10069.0" instead of "number", in the condition "$ (TargetPlatformVersion)"> "8.0". C: \ Program Files (x86) \ MSBuild \ 12.0 \ bin \ Microsoft.Common.CurrentVersion.targets

I'm not sure why some projects load correctly and others do not, however this seems to be the case for all C # projects that reference NuGet packages.

Is there a way to fix these errors and allow the solution and projects to open in both VS2013 and VS2015?

+3


source to share


1 answer


After checking various changes in the project files, I found that removing the following line from my own C ++ project allowed all projects in the solution to load correctly.

<TargetPlatformVersion>10.0.10069.0</TargetPlatformVersion>

      

However, after downloading, I found that I was unable to build my own project due to the error:

error MSB8020: Build tools for v140 (Platform Toolset = 'v140) could not be found.

Despite what vcxproj points out ToolsVersion="14.0"

, it looks like Visual Studio 2013 will use 12.0 for C ++ projects. The project properties Platform toolset

says v140 (not installed)

. Changing this Visual Studio 2013 (v120)

to would allow the project to build both VS2013 and VS2015, although obviously using older 12.0 tools rather than 14.0. Instead, I added the following lines to the project file:



<PlatformToolset Condition="'$(VisualStudioVersion)' == '12.0'">v120</PlatformToolset>
<PlatformToolset Condition="'$(VisualStudioVersion)' >= '14.0'">v140</PlatformToolset>

      

Now VS2013 will use v120

Platform toolset

and VS2105 (and later) will use v140

.

After building with VS 2015, the project file may contain the line TargetPlatformVersion

and / or WindowsTargetPlatformVersion

. If the value is 10.0.10240.0

or another version of Windows 10, then the project will not load in VS 2013 because it doesn't like a value that is not equal to the decimal value. This can be fixed by changing the value to 8.1

instructing Visual Studio to use the Windows Kit for Windows 8.1 and not Windows 10.

Note: Even though you can target .Net 4.6 with VS2013, it doesn't understand C # 6, so it will give errors if you try to use any new language features. Likewise, targeting a v120

C ++ project disallows new language features supported in VS2015.

+2


source







All Articles