src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Extensibility/ProjectExportProvider.cs
/// <summary>
/// Returns the export for the given project without having to go to the 
/// UI thread. This is the preferred method for getting access to project specific
/// exports
/// </summary>
Returns the export for the given project without having to go to the
UI thread. This is the preferred method for getting access to project specific
exports
Returns the export for the given project without having to go to the UI thread . This is the preferred method for getting access to project specific exports
public T GetExport<T>(string projectFilePath) where T : class
        {
            if (string.IsNullOrEmpty(projectFilePath))
            {
                throw new ArgumentNullException(nameof(projectFilePath));
            }
            var projectService = ProjectServiceAccesspr.GetProjectService();
            if (projectService == null)
            {
                return null;
            }
            var unconfiguredProject = projectService.LoadedUnconfiguredProjects
                                                    .FirstOrDefault(x => x.FullPath.Equals(projectFilePath,
                                                                            StringComparison.OrdinalIgnoreCase));
            return unconfiguredProject?.Services.ExportProvider.GetExportedValueOrDefault<T>();
        }
public T GetExport < T > ( string projectFilePath ) where T : class { if ( string . IsNullOrEmpty ( projectFilePath ) ) { throw new ArgumentNullException ( nameof ( projectFilePath ) ) ; } var projectService = ProjectServiceAccesspr . GetProjectService ( ) ; if ( projectService == null ) { return null ; } var unconfiguredProject = projectService . LoadedUnconfiguredProjects . FirstOrDefault ( x => x . FullPath . Equals ( projectFilePath , StringComparison . OrdinalIgnoreCase ) ) ; return unconfiguredProject ? . Services . ExportProvider . GetExportedValueOrDefault < T > ( ) ; }
Returns the export for the given project without having to go to the
UI thread.
Returns the export for the given project without having to go to the UI thread .
projectFilePath
string