Visual Studio 2015 - 命令行重定目标解决方案

时间:2015-10-27 23:12:17

标签: visual-studio visual-studio-2010 visual-studio-2015

尝试使用Visual Studio 2015从命令行构建旧项目(VS2010)。但是,我得到了这个:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Retarget solution".

任何人都知道如何"重新定位解决方案"从命令行?

1 个答案:

答案 0 :(得分:17)

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found.

显然,您没有安装Visual Studio 2010 (Platform Toolset = 'v100')工具集,而您的旧项目(Visual Studio 2010)引用它。

您的选择:

  1. 如果在Visual Studio 2015中打开vcxproj文件Go to project properties -> General settings.,您将看到有一个PlatformToolset属性。对于Visual Studio 2015,它是v140;对于Visual Studio 2010,它是v100

    将平台工具集更改为Visual Studio 2015 (Platform Toolset = 'v140')。然后,您可以从命令行和VS编辑器构建(注意,升级解决方案并不能保证解决方案能够构建正常的。)

  2. 您可以在不更改vcxproj文件的情况下设置PlatformToolset。您可以使用/p:PlatformToolset=v140覆盖PlatformToolset属性以更改工具集。

    e.g。 msbuild myProject.vcxproj /p:PlatformToolset=v140

  3. 如果您不了解Platform Toolset及其值:

    Visual Studio .NET 2002 (Platform Toolset = 'v70')
    Visual Studio .NET 2003 (Platform Toolset = 'v71')
    Visual Studio 2005      (Platform Toolset = 'v80')
    Visual Studio 2008      (Platform Toolset = 'v90')
    Visual Studio 2010      (Platform Toolset = 'v100')
    Visual Studio 2012      (Platform Toolset = 'v110')
    Visual Studio 2013      (Platform Toolset = 'v120')
    Visual Studio 2015      (Platform Toolset = 'v140')
    Visual Studio 2017      (Platform Toolset = 'v141')
    ...
    
相关问题