Repository navigation
Added support for Visual Studio Community, Professional, Enterprise - 2017 (v15.2^), 2019, 2022 on Windows 64-bit - #14664
Conversation
|
@Nico-Connor nice to see someone tackling the unstable keys of Visual Studio 🥳 I tested the branch, and it works like a charm 🎉 I have a few suggestions on how to improve the PR:
|
| if(process.env['ProgramFiles(x86)']){ | ||
| vswherePath = Path.join(process.env['ProgramFiles(x86)'], 'Microsoft Visual Studio', 'Installer', 'vswhere.exe'); | ||
| } | ||
| if(vswherePath !== undefined && existsSync(vswherePath)){ |
There was a problem hiding this comment.
You can use pathExists instead of existsSync.
There was a problem hiding this comment.
Also on x86 I believe Program Files (x86) does not exist as it is named Program Files if I remember from my 32 bit windows days.
There was a problem hiding this comment.
@AraHaan that shouldn't be a problem since we only offer 64bit builds, right?
| } | ||
| if(vswherePath !== undefined && existsSync(vswherePath)){ | ||
| try { | ||
| const vswhereStdOut = execFileSync(vswherePath, ['-version', '['+String(version)+','+String(version+1)+')', '-products', productId, '-property', 'instanceId'],{timeout: 2000, killSignal: 'SIGKILL'}); |
There was a problem hiding this comment.
- Instead of
execFileSyncyou can utilizeexecFilefrom../exec-file(it returns a Promise). It will make it consistent with other usages across GitHub Desktop - Perhaps you can use template literal for
['+String(version)+','+String(version+1)+') - I'm not sure that's a problem, but the format of
['+String(version)+','+String(version+1)+')look a bit odd... it opens with square brackets, and it ends with closing parenthesis?
There was a problem hiding this comment.
https://github.com/microsoft/vswhere/blob/develop/src/vswhere.lib/VersionRange.cpp#L105-L108 take a look at this to know why the ) is at the end.
|
Hey @Nico-Connor 👋 Thank you very much for your contribution ❤️ However, there is a major issue with it, related to how Desktop creates that list of editors. Right now, that list of editors is built when the app starts, which is kind of ok as long as that happens very quick. However, your PR requires running external processes to determine the location/existence of Visual Studio installations, which will definitely slow down the app start. We've been discussing about it and we think it's time to refactor all this code so that Desktop does all this work asynchronously and on-demand when the app needs it (i.e. when the user wants to open the repo on their selected editor, or when the user opens Because of all of this, I'm afraid we cannot merge your PR without having that refactor first, sorry 😞 |
|
That is very sensible reasoning! I look forward to the completion of the refactoring. Would you be able to link the new issue when it's up? I wouldn't mind following the progress of the new issue 😉. |
|
Here it is: #14666 Thank you for being so understanding 🙇♂️ ❤️ |
Closes #12946
Description
Implementing Visual Studio support required an unconventional approach since Visual Studio doesn't use a unique registry key like most other IDEs.
Thankfully as of Visual Studio 2017 v15.2, Microsoft includes a CLI tool called vswhere with the visual studio installer to help locate the unique registry of their IDE.
Screenshots
Workstation 1
Workstation 2
Release notes
Added IDE support for Windows 64 bit installations of:
Notes:
I don't have access to a 32 bit computer and therefore couldn't explore what the root path of Visual Studio is on 32 bit computers.
It would be nice to have someone test this code with any version of visual studio 2017 15.2 and up and have someone test this with any supported version of visual studio enterprise.
A different implementation approach that I tried: