Like Visual Studio 2017, Visual Studio 2019 does not define a convenient environment variable for checking and getting the location of the environment variable-setting batch file. This patch duplicates the hack used for finding VS 2017 to find VS 2019
Details
Diff Detail
- Repository
- R32 KDevelop
- Branch
- vs2019
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 12415 Build 12433: arc lint + arc unit
echo Define which compiler for VS2017 to use. Possible architectures are:
VS2017 should change too. Any ideas if this should print the VS exact version or just a generic question?
Which part of the patch are you referring to? I didn't intentionally do anything differently than the VS2017 hack, I tried to just duplicated that same method for VS2019.
For VS2015 and earlier, it appears the installer defined an environment variable pointing to the tools which the previous versions of this script used. For VS2017+, that variable doesn't seem to exist
(I have VS2015 and VS2019 on my computer, which is my basis for making the above claims)
Oops. Good catch. Would it work to just say Define which toolchain to use. Possible architectures are: rather than me having to go any further into Windows Batch scripting than I have to? :)
brauch is referring to this
for /f "usebackq tokens=3*" %%a in (`reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\VisualStudio\SxS\VS7" /s`) do ( set vs15_path=%%a %%b if exist "!vs15_path!Common7\Tools\VsDevCmd.bat" ( set "VS150COMNTOOLS=!vs15_path!Common7\Tools\" goto :end ) ) ) :end
It's best to leave windows decide where VS is installed rather than guessing (even if it's successful for 99% of the cases). I used to install software which required many GB to another partition since C: was tiny.
About the message of the toolchain I think it's correct. Keep it simple ;) You might want to keep your changes as a backup and start over, but consult the devs too. Good luck!
EDIT: Wrong code quote
Oops. What happened here is I was hacking on the release version which looks more like the patch I posted. I'll see if I can make sense of the master branch version and make it more like that!
It's best to leave windows decide where VS is installed rather than guessing (even if it's successful for 99% of the cases). I used to install software which required many GB to another partition since C: was tiny.
About the message of the toolchain I think it's correct. Keep it simple ;) You might want to keep your changes as a backup and start over, but consult the devs too. Good luck!
I'm sorry. I haven't forgotten. I have just covered with hot irons for quite awhile :). I am currently on travel and I will be for several more weeks but when I am able to get my VM working again I will make sure to update this patch
Actually, there is a bit of a problem... The version of the file currently on master is bugged :(
Not really. Here is a blog post which provides suggestions for how to use it: https://renenyffenegger.ch/notes/Windows/development/Visual-Studio/environment-variables/index
Things are going to be crazy for me until probably September, so if you want to have a look in to this I would appreciate it. I can probably test whatever you come up with if you ping me :)
Hi,
I have installed Build Tools for VS2019 and the installation is at
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools
I found this string inside HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\1eb19443 which honestly doesn't seem the proper key to extract this value but anyway.
A small preview of what I wrote is this:
@echo off setlocal enabledelayedexpansion setlocal enableextensions REM Visual Studio 2019 is tricky to be found. set VS2019_KEY_NAME="HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\1eb19443" set VS2019_VAL_NAME="InstallLocation" for /f "usebackq skip=2 tokens=3*" %%a in (`^(reg query %VS2019_KEY_NAME% /v %VS2019_VAL_NAME% ^| find "%VS2019_VAL_NAME%"^) 2^>nul `) do ( set vs16_path=%%b if exist "!vs16_path!Common7\Tools\LaunchDevCmd.bat" ( set "VS160COMNTOOLS=!vs15_path!Common7\Tools\" goto :end ) )
No matter what I try I get the error "ERROR: The system was unable to find the specified registry key or value." Any ideas?
EDIT My script accounts only for BuildTools, thats wrong.
Update for those watching: I have just posted a new version of the script to Invent which uses vswhere.exe to locate the installed versions of Visual Studio. I'll be abandoning this revision since IMO vswhere is the best way forward. Check it out here: https://invent.kde.org/kdevelop/kdevelop/-/merge_requests/259