简体   繁体   中英

Visual Studio using older 2012 compiler on a project converted to 2013

I have inherited a (small) build system from VS2012 that our team wishes to take to VS2013. I have run the wizard on the solution to "convert" to 2013 and this has dutifully changed the VisualStudioVersion and Project ToolsVersion in various .vcxproj files to "12.0" and added a few extra fields here and there with no errors or warnings reported.

But, the IDE is still showing these projects as 2012:

Solution 'foo'
   Bar (Visual Studio 2012)

And the IDE is still allowing me to "upgrade" these projects. I did note that the conversion process also did not touch any .props files and I have gone through and manually updated them, but still it does not seem to be using the latest version of the compiler and the IDE still is confused - or isn't.

I am an MSBuild newbie here so perhaps this is just a simple missing flag somewhere - hopefully?

Also, I get a ton of schema warnings on first build, but I believe this is a known feature from my research.

What else should I look into here?

Ensure each configuration property group (ie each group that defines a build configuration) targets the 2013 compiler in its PlatformToolset element:

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
    <PlatformToolset>v120</PlatformToolset>
    ...
</PropertyGroup>

Check also that you do not have duplicate property groups - there should only be one instance of any property group with the same Condition and Label attributes. .vcxproj files can become fragmented over time due to merging and insertion/deletion of platforms and configurations, with duplicate groups effectively undefining configuration elements defined earlier in the file. Combine duplicate property groups into a single group.

If you are defining the toolset version in a macro in one of your props files, ensure it is v120.

Also check that your props files are associated with all the project configurations you expect. You can view which props have been included directly in the ImportGroup element in the vcxproj file for each configuration, or alternatively look in the Property Manager in Visual Studio - expand each Configuration|Platform node to see a list of the props files that have been included.

Finally, if your project has CLR support, set the framework version to v4.5.1:

<Project>
    <PropertyGroup Label="Globals">
        <TargetFrameworkVersion>v4.5.1</TargetFrameworkVersion>
        ...
    </PropertyGroup>
</Project>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM