in Backend/RiderPlugin/ForTea.RiderPlugin/Psi/Resolve/Macros/FeatureAware/T4RiderFeatureAwareMacroResolver.cs [42:69]
private IReadOnlyDictionary<string, string> ResolveOnlyHeavyMacros(
[NotNull] IList<string> heavyMacros,
[NotNull] IProjectFile file
)
{
Logger.Verbose("Resolving {0} heavy (msbuild) macros", heavyMacros.Count);
var project = file.GetProject();
if ((project.GetProjectKind() & (ProjectKind.REGULAR_PROJECT | ProjectKind.WEB_SITE)) == 0)
{
return EmptyDictionary<string, string>.Instance;
}
var mark = project?.GetProjectMark();
if (mark == null) return EmptyDictionary<string, string>.Instance;
var projectsHostContainer = Solution.ProjectsHostContainer();
var msBuildSessionHolder = projectsHostContainer.GetComponent<MsBuildSessionHolder>();
var msBuildSession = msBuildSessionHolder.Session;
var result = new Dictionary<string, string>();
var currentTargetFrameworkId = project.GetCurrentTargetFrameworkId();
foreach (string heavyMacro in heavyMacros)
{
string value = msBuildSession.GetProjectProperty(mark, heavyMacro, currentTargetFrameworkId);
if (value.IsNullOrEmpty()) continue;
result[heavyMacro] = value;
}
return result;
}