0

Following How to install Visual Studio Build Tools unattended? I installed Visual Studio Build Tools with:

# Visual Studio build tools
Write-Host "Installing visual studio build tools..." -ForegroundColor Cyan

cd $env:USERPROFILE

$exePath = "$env:TEMP\vs.exe"

Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_BuildTools.exe -UseBasicParsing -OutFile $exePath

Write-Host "layout..." -ForegroundColor Cyan

Start-Process $exePath -ArgumentList "--layout .\vs_BuildTools --quiet" -Wait
cd vs_BuildTools

Write-Host "actual installation..." -ForegroundColor Cyan

Start-Process vs_setup.exe -ArgumentList "--installPath $env:USERPROFILE\vs_BuildTools2022 --nocache --wait --noUpdateInstaller --noWeb --allWorkloads --includeRecommended --includeOptional --quiet --norestart" -Wait

You can see that I installed locally so I don't need admin permissions.

When I try to install something with vcpkg, however, it can't find my Visual Studio Build Tools installation:

Write-Host "Installing vcpkg..." -ForegroundColor Cyan

git clone https://github.com/Microsoft/vcpkg.git C:\src\vcpkg

C:\src\vcpkg\bootstrap-vcpkg.bat

C:\src\vcpkg\vcpkg.exe --version
C:\src\vcpkg\vcpkg.exe install gtest

gives

 error: in triplet x64-windows: Unable to find a valid Visual Studio instance

Is there some variable that I can set so vcpkg can find the Visual Studio Build Tools local installation?

Guerlando OCs
  • 1,886
  • 9
  • 61
  • 150
  • I don't think the build tools alone are enough: https://github.com/microsoft/vcpkg-tool/pull/314 – Luke Aug 18 '22 at 22:23

2 Answers2

0

You can use set VCPKG_VISUAL_STUDIO_PATH in the triplet ( or via --x-cmake-args=-DVCPKG_VISUAL_STUDIO_PATH=<yourpath> for testing -> deactivates binary caching)

also running vcpkg with --debug might help to deduce why some found installations got rejected.

Alexander Neumann
  • 1,479
  • 8
  • 17
0

first of all vcpkg lookup your installed vs versions here: C:\ProgramData\Microsoft\VisualStudio\Packages\_Instances

user1005462
  • 158
  • 2
  • 7