Example #1
0
        public static async Task <VSVersion> GetVersionAsync(IAsyncServiceProvider serviceProvider)
        {
            serviceProvider.ThrowOnNull(nameof(serviceProvider));

            if (!ThreadHelper.CheckAccess())
            {
                await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();
            }

            Version?shellVersion = await VS.Shell.GetVsVersionAsync();

            if (shellVersion != null)
            {
                return(new VSVersion(shellVersion));
            }

            var unknownVersion = new Version(VSVersion.UnknownVersion, VSVersion.UnknownVersion);

            return(new VSVersion(unknownVersion));
        }