How can I check/detect which Visual Studio version is running under my VSPackage?
I cannot get from the registry because the computer could have several versions installed, so I guess there is an API that is able to get it.
Anybody knows how to get it from a managed Visual Studio package using C#?
On macOS, go to Code > About Visual Studio Code. On Windows and Linux, go to Help > About. The VS Code version is the first Version number listed and has the version format 'major.
Click on Help > About Microsoft Visual Studio . You will see the version number and the update you have installed.
You could try to get version via automation DTE object. In MPF you could get it in this way:
EnvDTE.DTE dte = (EnvDTE.DTE)Package.GetGlobalService(typeof(EnvDTE.DTE));
There are some other related things to retrieve DTE object - via Project.DTE, also read this thread if you're getting null for DTE.
Then you can get the version by using DTE.Version property.
Also useful information could be found on Carlos Quintero (VS addin ninja) website HOWTO: Detect installed Visual Studio editions, packages or service packs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With