docs/roslyn-language-server-copilot-plugin.md
The roslyn-language-server is a .NET tool that provides C# language intelligence (go-to-definition, find references, diagnostics, etc.) to AI coding agents via the Language Server Protocol (LSP). It is distributed as a plugin through the dotnet/skills marketplace, enabling automatic installation and use in tools like GitHub Copilot CLI.
In your agent (Copilot CLI, etc.), add the marketplace and install the dotnet plugin:
/plugin marketplace add dotnet/skills
/plugin install dotnet@dotnet-agent-skills
Restart the agent to load the plugin. Once installed, the agent will automatically have access to C# language intelligence for .cs files through the LSP.
With the plugin active, the agent gains LSP-powered capabilities for C# code:
PATH. Your project can still use an older, supported SDK.The language server automatically discovers and loads projects using the following strategy (evaluated in order):
dotnet.defaultSolution)If a .vscode/settings.json file exists in the workspace folder, the server reads the dotnet.defaultSolution setting:
// .vscode/settings.json
{
"dotnet.defaultSolution": "src/MyApp.sln"
}
.sln or .slnx file are supported."disable" to prevent the server from loading any solution or projects automatically:
{
"dotnet.defaultSolution": "disable"
}
If there is exactly one .sln or .slnx file at the root of the workspace folder, the server will automatically load that solution.
As a fallback, the server recursively discovers all .csproj files within the workspace folders and loads them individually.
/lsp show should show the server configured for C#: Plugin-configured servers:
• csharp: (.cs) [from dotnet]
Copilot CLI writes LSP server logs to the .copilot/logs/ directory in your home folder. To inspect the language server's output:
~/.copilot/logs/%USERPROFILE%\.copilot\logs\Look for log files related to csharp or roslyn-language-server. These contain the server's startup output, project loading progress, and any errors encountered. This is the first place to check when the language server isn't behaving as expected.
dotnet is on your PATH.nuget.config (repo, user, or machine-level) that restricts package sources; dnx uses NuGet sources to resolve tools.nuget.org (or an other feed that mirrors roslyn-language-server) is enabled, for example with dotnet nuget list source.dotnet tool install -g roslyn-language-server --prerelease.If the LSP logs show failures loading projects
dotnet --version.dotnet build before using the language server.dotnet.defaultSolution in .vscode/settings.json to specify which solution to load.dotnet.defaultSolution) rather than relying on individual project discovery, which may load test projects and other projects you don't need.The plugin is configured in the dotnet/skills repository via plugins/dotnet/lsp.json:
When the agent opens a workspace containing .cs files, it will:
roslyn-language-server .NET tool on-the-fly using dotnet dnx (which downloads and caches the tool automatically; --yes skips confirmation and --prerelease allows prerelease versions).--stdio) using the Language Server Protocol.--autoLoadProjects) so that the agent immediately has full semantic understanding of the codebase.| Option | Description |
|---|---|
--stdio | Use stdio for LSP communication (required for most agent integrations) |
--autoLoadProjects | Automatically discover and load projects from workspace folders |
--logLevel <level> | Minimum log verbosity (default: Information) |
--debug | Launch the debugger on startup |