How to get solution path in .NET code analyzer
问题 How do you get access the file path to the project/solution being compiled inside a Roslyn code analyzer? I need to verify the code against some spec files stored relative to the code. Things that do NOT work: SyntaxTreeAnalysisContext.Tree.FilePath Assembly.GetExecutingAssembly().Location AppDomain.CurrentDomain.BaseDirectory Environment.CurrentDirectory Path.GetFullPath(relativePath) 回答1: Analyzers exist below the Workspace level (they're run directly by the compiler), so the solution may