代码之家  ›  专栏  ›  技术社区  ›  Shir

项目文件包含ToolsVersion=“15.0”。此工具集可能未知或丢失

  •  0
  • Shir  · 技术社区  · 7 年前

    我正在尝试编译一个开源项目,以便在windows上使用它( this one ). 我用的是CMake,我用的是 __build.cmd

    我刚刚安装了Visual Studio 2017社区版(要求是2013或更高版本)。

    当试图编译这个(使用 __生成.cmd

    Release|Win32
    Build started 27/11/2018 17:15:25.
         1>Project "C:\Users\SHIRM\out_git\gptp\windows\gptp.sln" on node 1 (Clean;Build target(s)).
         1>ValidateSolutionConfiguration:
             Building solution configuration "Release|Win32".
           ValidateProjects:
             The project "ALL_BUILD" is not selected for building in solution configuration "Release|Win32".
         1>Project "C:\Users\SHIRM\out_git\gptp\windows\gptp.sln" (1) is building "C:\Users\SHIRM\out_git\gptp\windows\ZERO_CHECK.vcxproj" (2) on node 1 (Clean target(s)).
           Project file contains ToolsVersion="15.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular
           ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0". For more information, please see http://go.microsoft.com/fwlink/?LinkId=291333.
         2>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.CppClean.targets(76,5): error MSB4062: The "CppClean" task could not be loaded from the assembly C:\Program Files (x86)\Microsoft Vi
           sual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one
           of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that impleme
           nts Microsoft.Build.Framework.ITask. [C:\Users\SHIRM\out_git\gptp\windows\ZERO_CHECK.vcxproj]
         2>Done Building Project "C:\Users\SHIRM\out_git\gptp\windows\ZERO_CHECK.vcxproj" (Clean target(s)) -- FAILED.
         1>Done Building Project "C:\Users\SHIRM\out_git\gptp\windows\gptp.sln" (Clean;Build target(s)) -- FAILED.
    
    Build FAILED.
    

    我知道问题可能是 Project file contains ToolsVersion="15.0".... Treating the project as if it had ToolsVersion="4.0"

    关键是-据我所知,我有正确的MSBuild版本。例如,我有一个名为 15.0 里面 C:\Program Files (x86)\MSBuild . 2.0 , 3.5 , 4.0 在下面 Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions 在登记处( 15.0分 不在MSBuild注册表本身中)

    为了解决这个问题,我从 here 14.0 C: 程序文件(x86)MSBuild ,并返回到注册表位置,但错误保持不变(!)[即使我删除了所有的Cmake结果并再次使用它]。

    我在这里有点迷路了,因为我对Windows不太了解,也没有编写任何我想使用的代码。

    知道我能做什么吗?谢谢!

    我认为这可能与CMake选项有关。有一个选择工具版本的选项,我不使用。也许我该选点什么?(我试了14.0,4.0,14,但是没有成功)-

    enter image description here

    0 回复  |  直到 6 年前
    推荐文章