private static IVsVersion CalculateVersion(IServiceProvider serviceProvider, ISetupConfigurationProvider setupConfigurationProvider, ILogger logger)
        {
            try
            {
                var vsShell = serviceProvider.GetService(typeof(SVsShell)) as IVsShell;
                vsShell.GetProperty((int)__VSSPROPID.VSSPROPID_InstallDirectory, out var installDir);

                var setupConfiguration    = setupConfigurationProvider.Get();
                var setupInstance         = setupConfiguration.GetInstanceForPath((string)installDir);
                var productName           = setupInstance.GetDisplayName();
                var productVersion        = setupInstance.GetInstallationVersion();
                var catalog               = (ISetupInstanceCatalog)setupInstance;
                var catalogInfo           = catalog.GetCatalogInfo();
                var productDisplayVersion = catalogInfo.GetValue("productDisplayVersion") as string;

                logger.WriteLine(Resources.VsVersionDetails,
                                 productName,
                                 productVersion,
                                 productDisplayVersion);

                return(new VsVersion(productName, productVersion, productDisplayVersion));
            }
            catch (Exception ex)
            {
                logger.LogDebug(Resources.FailedToCalculateVsVersion, ex);

                return(null);
            }
        }
 internal VsVersionProvider(IServiceProvider serviceProvider, ISetupConfigurationProvider setupConfigurationProvider, ILogger logger)
 {
     Version = CalculateVersion(serviceProvider, setupConfigurationProvider, logger);
 }