public MSBuildRuntimeEvaluationContext(IRuntimeInformation runtime) { if (runtime is Editor.Completion.NullRuntimeInformation) { return; } string binPath = MSBuildEscaping.ToMSBuildPath(runtime.BinPath); string toolsPath = MSBuildEscaping.ToMSBuildPath(runtime.ToolsPath); Convert("MSBuildExtensionsPath"); Convert("MSBuildExtensionsPath32"); Convert("MSBuildExtensionsPath64"); void Convert(string name) { if (runtime.SearchPaths.TryGetValue(name, out var vals)) { values[name] = new MSBuildPropertyValue(vals.ToArray()); } } values["MSBuildBinPath"] = binPath; values["MSBuildToolsPath"] = toolsPath; values["MSBuildToolsPath32"] = toolsPath; values["MSBuildToolsPath64"] = toolsPath; values["RoslynTargetsPath"] = $"{binPath}\\Roslyn"; values["MSBuildToolsVersion"] = runtime.ToolsVersion; values["VisualStudioVersion"] = "15.0"; values["MSBuildProgramFiles32"] = MSBuildEscaping.ToMSBuildPath(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86)); values["MSBuildProgramFiles64"] = MSBuildEscaping.ToMSBuildPath(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)); var defaultSdksPath = runtime.SdksPath; if (defaultSdksPath != null) { values["MSBuildSDKsPath"] = MSBuildEscaping.ToMSBuildPath(defaultSdksPath, null); } //these are read from a config file and may be described in terms of other properties void Collapse(string name) { if (values.TryGetValue(name, out var val)) { values["name"] = val.Collapse(this); } } Collapse("MSBuildExtensionsPath"); Collapse("MSBuildExtensionsPath32"); Collapse("MSBuildExtensionsPath64"); }
public bool TryGetProperty(string name, out MSBuildPropertyValue value) { if (fileContext.TryGetProperty(name, out value)) { return(true); } if (collector.TryGetValues(name, out var values)) { value = new MSBuildPropertyValue(values); return(true); } return(false); }
public bool TryGetProperty(string name, out MSBuildPropertyValue value) => values.TryGetValue(name, out value) || runtimeContext.TryGetProperty(name, out value);
public bool TryGetProperty(string name, out MSBuildPropertyValue value) => values.TryGetValue(name, out value);