Skip to content

Csharp-language-server

This is a hacky Roslyn-based LSP server for C#, as an alternative to omnisharp-roslyn.

Installation

dotnet tool install --global csharp-ls

See also

Troubleshooting

error NU1202: Package csharp-ls 0.7.0 is not compatible with net6.0

설치 도중 다음과 같은 에러가 발생된다.

/tmp/1f0ceaad-f897-4f58-b397-485376df4098/restore.csproj : error NU1202: Package csharp-ls 0.7.0 is not compatible with net6.0 (.NETCoreApp,Version=v6.0) / any. Package csharp-ls 0.7.0 supports: net7.0 (.NETCoreApp,Version=v7.0) / any
The tool package could not be restored.
Tool 'csharp-ls' failed to install. This failure may have been caused by:

* You are attempting to install a preview release and did not use the --version option to specify the version.
* A package by this name was found, but it was not a .NET tool.
* The required NuGet feed cannot be accessed, perhaps because of an Internet connection problem.
* You mistyped the name of the tool.

For more reasons, including package naming enforcement, visit https://aka.ms/failure-installing-tool

결론만 말하면 net7.0 을 설치해야 한다.

dotnet 페이지를 참조하여 다시 설치하고 다시 설치를 시도하면 된다.

$ dotnet tool install --global csharp-ls

출력은 다음과 같다:

Welcome to .NET 7.0!
---------------------
SDK Version: 7.0.202

Telemetry
---------
The .NET tools collect usage data in order to help us improve your experience. It is collected by Microsoft and shared with the community. You can opt-out of telemetry by setting the DOTNET_CLI_TELEMETRY_OPTOUT environment variable to '1' or 'true' using your favorite shell.

Read more about .NET CLI Tools telemetry: https://aka.ms/dotnet-cli-telemetry

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate run 'dotnet dev-certs https --trust' (Windows and macOS only).
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
You can invoke the tool using the following command: csharp-ls
Tool 'csharp-ls' (version '0.7.0') was successfully installed.

See also

Favorite site