/
githubmirror
/
roslyn
Обзор
Документация
Войти
/
githubmirror
/
roslyn
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
src/Compilers/Extension/SetGlobalGlobalPropertiesForCPS.cs
37 строк
2 KB
Jason Malinowski
Fix the Compiler VSIX extension so it works with CPS projects again
05 апр 2022, 04:37
05 апр 2022, 04:37
bb33e53
Код
Авторство
О чём код?
// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. #nullable disable using System; using System.Collections.Immutable; using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.VisualStudio.ProjectSystem; using Microsoft.VisualStudio.ProjectSystem.Build; namespace Roslyn.Compilers.Extension { [ExportBuildGlobalPropertiesProvider] [AppliesTo("(" + ProjectCapabilities.CSharp + " | " + ProjectCapabilities.VB + ")" + " & " + ProjectCapabilities.LanguageService)] public class SetGlobalGlobalPropertiesForCPS : StaticGlobalPropertiesProviderBase { [ImportingConstructor] [Obsolete("This exported object must be obtained through the MEF export provider.", error: true)] public SetGlobalGlobalPropertiesForCPS(IProjectService projectService) : base(projectService.Services) { } public override Task<IImmutableDictionary<string, string>> GetGlobalPropertiesAsync(CancellationToken cancellationToken) { // Currently the SolutionExists context will always occur before CPS calls this class // If this behavior ever changes we will need to modify this class. return CompilerPackage.RoslynHive != null ? Task.FromResult<IImmutableDictionary<string, string>>(Empty.PropertiesMap.Add("RoslynHive", CompilerPackage.RoslynHive)) : Task.FromResult<IImmutableDictionary<string, string>>(Empty.PropertiesMap); } } }