模具:未安装 PlatformToolset v120

Die : PlatformToolset v120 is not installed

我正尝试按照本教程在我的 Windows 10 (x64) 笔记本电脑上安装 Openalpr Openalpr for Windows 但是当我在步骤 为x64 目标工具链 v120 我在 Windows Powershell:

中收到以下错误
Die : PlatformToolset v120 is not installed.
At C:\Users\shama_000\Google Drive\Projects\Git Projects\openalpr\windows\build.ps1:230 char:9
+         Die "PlatformToolset $PlatformToolset is not installed."
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Die

我用 Notepad++ 打开文件来搜索问题,它说:

if ($VXXCommonTools -eq $null -or (-not (Test-Path($VXXCommonTools)))) {
    Die "PlatformToolset $PlatformToolset is not installed."}

但是在代码的开头,在 param 部分我发现了这个:

[ValidateSet("v100", "v110", "v120", "v140")]

所以它应该适用于任何版本的 PlatformToolset(或者至少这是我的逻辑)。我不知道我有这个工具集的哪个版本,但我一直在互联网上搜索这个错误,我只找到关于 Visual Studio 的帖子,比如这个 The builds tools for v120 (Platform Toolset = 'v120') cannot be found 但 "solution"对于这个问题是安装最新版本的Visual Studio。现在我已经安装了 Visual Studio 2015 所以,对于这个问题的答案,这应该已经有效了。

当我发现我已经有了这个变量时,我正在搜索可能会破坏我的构建的环境变量:VS140COMNTOOLS

因此,当我再次在 Windows PowerShell 中编写要构建的命令时,只需将 PlatformToolset 更改为 v140:

.\build.ps1 -Configuration Release -Platform x64 -PlatformToolset v140 -CudaGeneration None

成功了。问题是我的构建找不到任何工具集 v120,因为那里没有,唯一的是 v140。因此,如果您有同样的问题,请在您的环境变量中搜索您的计算机正在使用的 PlatformToolset 并使用那个。