Visual Studio希望使用错误的平台工具集进行构建

tmi*_*hty 13 c++ build-tools visual-studio-2010 visual-studio-2012

我已经将VS2010的解决方案升级到了VS2012.我用其他解决方案做到了,它工作得很好.

但是现在当我尝试构建更新的解决方案时,编译器告诉我:

Error 1596  error MSB8020: The builds tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, either click the Project menu or right-click the solution, and then select "Update VC++ Projects...". Install Visual Studio 2010 to build using the Visual Studio 2010 build tools.    C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets   42  5   praat3
Run Code Online (Sandbox Code Playgroud)

我不知道为什么编译器会尝试使用VS2010.

在项目属性页面中,我在"调试源文件"下面看到以下条目:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\
etc.
Run Code Online (Sandbox Code Playgroud)

此外,如果我将"Platformtoolset"设置为"从上面的项目继承或项目标准",则默认为"v100".我认为这是关于这里出了什么问题的最佳暗示.

偶然我设法打开了Microsoft.Cpp.Platform.targets文件,我看到那里列出了v90和v100,但没有列出v110.

只使用VS2012的人可能会查看该文件吗?

这就是我的样子:

<!--
***********************************************************************************************
Microsoft.Cpp.Platform.targets

WARNING:  DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
          created a backup copy.  Incorrect changes to this file will make it
          impossible to load or build your projects from the command-line or the IDE.

This file defines the steps/targets required to build Visual C++ projects
specifically on x86 platforms.

Copyright (C) Microsoft Corporation. All rights reserved.
***********************************************************************************************
-->

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ToolsetTargetsFound Condition="Exists('$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\$(PlatformToolset)\Microsoft.Cpp.$(Platform).$(PlatformToolset).targets')">true</ToolsetTargetsFound>
    <VCTargetsPathEffective Condition="'$(ToolsetTargetsFound)' == 'true'">$(VCTargetsPath)</VCTargetsPathEffective>
  </PropertyGroup>

  <!-- Import Before -->
  <Import Condition="Exists('$(VCTargetsPath)\Platforms\$(Platform)\ImportBefore')" Project="$(VCTargetsPath)\Platforms\$(Platform)\ImportBefore\*.targets"/>
  <!-- Import platform toolset file if found in this version -->
  <Import Condition="'$(ToolsetTargetsFound)' == 'true'" Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\$(PlatformToolset)\Microsoft.Cpp.$(Platform).$(PlatformToolset).targets" />
  <!-- Try to find the toolset in older versions  -->
  <Import Condition="'$(ToolsetTargetsFound)' != 'true' and '$(MinSupportedVCTargetsVersion)' != 'v110'" Project="Microsoft.Cpp.Platform.Redirect.targets" />

  <PropertyGroup>
    <PrepareForBuildDependsOn>PlatformPrepareForBuild;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
  </PropertyGroup>

  <Target Name="PlatformPrepareForBuild" DependsOnTargets="$(PlatformPrepareForBuildDependsOn)">
    <PropertyGroup>
      <ConfigurationPlatformExists Condition="'%(ProjectConfiguration.Identity)' == '$(Configuration)|$(Platform)'">true</ConfigurationPlatformExists>
    </PropertyGroup>

    <!-- Error out when building an platform that is not set in the project file -->
    <VCMessage Code="MSB8013" Type="Error" Arguments="$(Configuration)|$(Platform)" Condition="'$(DesignTimeBuild)'!='true' and '$(ConfigurationPlatformExists)' != 'true'"/>

    <!-- Check if toolset exists in Visual Studio 2010 or Dev11 -->
    <VCMessage Code="MSB8020" Type="Error" Arguments="$(_PlatformToolsetShortNameFor_v100);$(PlatformToolset)" Condition="'$(DesignTimeBuild)'!='true' and '$(ToolsetTargetsFound)' != 'true' and '$(PlatformToolset)' == 'v100'" />
    <VCMessage Code="MSB8020" Type="Error" Arguments="$(_PlatformToolsetShortNameFor_v90);$(PlatformToolset)" Condition="'$(DesignTimeBuild)'!='true' and '$(ToolsetTargetsFound)' != 'true' and '$(PlatformToolset)' == 'v90'" />
    <VCMessage Code="MSB8020" Type="Error" Arguments="$(PlatformToolset);$(PlatformToolset)" Condition="'$(DesignTimeBuild)'!='true' and '$(ToolsetTargetsFound)' != 'true' and '$(PlatformToolset)' != 'v90' and '$(PlatformToolset)' != 'v100'" />
  </Target>

  <!-- Import After -->
  <Import Condition="'$(ToolsetTargetsFound)' == 'true' and Exists('$(VCTargetsPath)\Platforms\$(Platform)\ImportAfter')" Project="$(VCTargetsPath)\Platforms\$(Platform)\ImportAfter\*.targets"/>
</Project>
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助.

egu*_*gur 11

该项目将使用VS2010编译器(平台工具集)进行构建.您可能已卸载VS2010并出现此错误.

您可以在项目属性 - >常规 - >平台工具集中更改平台工具集.将其更改为Visual Studio 2012.

  • 对于解决方案中的项目,它已设置为"Visual Studio 2012(v110)". (4认同)
  • 都是消极的.变量未设置,项目文件不包含v100. (2认同)

Gre*_*reg 5

最近使用 VS2017 对我来说同样的错误。

原来解决方案只是缺少一个依赖项目。
如果这是原因,您应该看到如下内容:

Done building project "someproject.vcxproj" -- FAILED.  
Run Code Online (Sandbox Code Playgroud)

在错误消息后的下一行:

error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.
Run Code Online (Sandbox Code Playgroud)

此错误可能会令人困惑,因为您的项目可能已被重新定位。

  • 同样在这里,我在传入的配置属性中有一个无效的名称。错误是一个红鲱鱼。 (2认同)

tmi*_*hty 2

在“C/C++”下,“附加包含目录”中有一个库。我没有使用这个lib,但它被引用了。我删除了这个库。

我还删除了注册表中的所有“studio 2010”条目。