Esempio n. 1
0
        public async Task <ImmutableDictionary <Guid, string> > GetProjectVersionsAsync(
            ImmutableArray <Guid> projectGuids,
            CancellationToken cancellationToken
            )
        {
            var service = _workspace.Services.GetRequiredService <ICodeLensReferencesService>();

            var builder  = ImmutableDictionary.CreateBuilder <Guid, string>();
            var solution = _workspace.CurrentSolution;

            foreach (var project in solution.Projects)
            {
                var projectGuid = _workspace.GetProjectGuid(project.Id);
                if (!projectGuids.Contains(projectGuid))
                {
                    continue;
                }

                var projectVersion = await service
                                     .GetProjectCodeLensVersionAsync(solution, project.Id, cancellationToken)
                                     .ConfigureAwait(false);

                builder[projectGuid] = projectVersion.ToString();
            }

            return(builder.ToImmutable());
        }
Esempio n. 2
0
        public async Task <ImmutableDictionary <Guid, string> > GetProjectVersionsAsync(ImmutableArray <Guid> projectGuids, CancellationToken cancellationToken)
        {
            var builder = ImmutableDictionary.CreateBuilder <Guid, string>();

            foreach (var project in _workspace.CurrentSolution.Projects)
            {
                var projectGuid = _workspace.GetProjectGuid(project.Id);
                if (!projectGuids.Contains(projectGuid))
                {
                    continue;
                }

                var projectVersion = await project.GetDependentVersionAsync(cancellationToken).ConfigureAwait(false);

                builder[projectGuid] = projectVersion.ToString();
            }

            return(builder.ToImmutable());
        }