public async static Task <VsMSBuildProjectSystem> CreateMSBuildNuGetProjectSystemAsync(IVsProjectAdapter vsProjectAdapter, INuGetProjectContext nuGetProjectContext) { await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); if (vsProjectAdapter == null) { throw new ArgumentNullException(nameof(vsProjectAdapter)); } if (string.IsNullOrEmpty(vsProjectAdapter.FullName)) { throw new InvalidOperationException( string.Format(CultureInfo.CurrentCulture, Strings.DTE_ProjectUnsupported, vsProjectAdapter.ProjectName)); } if (!vsProjectAdapter.IsDeferred && EnvDTEProjectUtility.SupportsProjectKPackageManager(vsProjectAdapter.Project)) { throw new InvalidOperationException( string.Format(CultureInfo.CurrentCulture, Strings.DTE_ProjectUnsupported, typeof(IMSBuildProjectSystem).FullName)); } var guids = await vsProjectAdapter.GetProjectTypeGuidsAsync(); if (guids.Contains(VsProjectTypes.CppProjectTypeGuid)) // Got a cpp project { return(new NativeProjectSystem(vsProjectAdapter, nuGetProjectContext)); } // Try to get a factory for the project type guid foreach (var guid in guids) { if (_factories.TryGetValue(guid, out var factory)) { return(factory(vsProjectAdapter, nuGetProjectContext)); } } // Fall back to the default if we have no special project types return(new VsMSBuildProjectSystem(vsProjectAdapter, nuGetProjectContext)); }