C# for Visual Studio Code (powered by OmniSharp)
Welcome to the C# extension for Visual Studio Code! This extension provides the following features inside VS Code:
- Lightweight development tools for .NET Core.
- Great C# editing support, including Syntax Highlighting, IntelliSense, Go to Definition, Find All References, etc.
- Debugging support for .NET Core (CoreCLR). NOTE: Mono debugging is not supported. Desktop CLR debugging has limited support.
- Support for project.json and csproj projects on Windows, macOS and Linux.
The C# extension is powered by OmniSharp.
Requirements
- .NET 6 SDK or newer when
omnisharp.useModernNet
is set totrue
(the default value). - A Full Framework runtime and MSBuild tooling when
omnisharp.useModernNet
is set tofalse
.- Windows: .NET Framework along with MSBuild Tools
- MacOS/Linux: Mono with MSBuild
Get Started Writing C# in VS Code
Announcements
The C# extension no longer ships with an included Mono & MSBuild Tools
.NET Framework builds of OmniSharp no longer ship with Mono or the MSBuild tooling (See announcement omnisharp-roslyn#2339). To ensure that the C# extension remains usable out of the box for .NET SDK projects, we have changed the default value of omnisharp.useModernNet
to true
.
If you still need Unity or .NET Framework support, you can set omnisharp.useModernNet
to false
in your VS Code settings and restart OmniSharp. Please see the Requirements section above to ensure necessary tooling is installed.
See issue #5120 for more details.
What's new in 1.25.8
- Update Razor to 7.0.0-preview.23258.1 (PR: #5672)
- Combine test compile step into normal compile (PR: #5666)
What's new in 1.25.7
What's new in 1.25.6
- Update Razor to 7.0.0-preview.23213.4 (PR: #5655)
- Fix serialization issue with project.razor.json files (PR: #8489)
What's new in 1.25.5
- Update Razor to 7.0.0-preview.23124.2 (PR: #5604)
- Fix colorization when nullable operators are present (#5570)
- Add C#/HTML folding range support (razor#8309)
- Formatting fixes (razor#8318)
- Update OmniSharp to 1.39.6 (PR: #5625)
- Use new VS threading version to match with Razor (PR:#2518)
- Update OmniSharp to 1.39.5 (PR: #5618)
- Automatically trust ASP.NET Core HTTPS development certificate (PR: #5589)
- Improve outline to be less verbose (PR: #5536)
- Update Razor TextMate grammar (PR: #5570)
What's new in 1.25.4
What's new in 1.25.3
- Update Razor to 7.0.0-preview.23067.5 (PR: #5543)
- Enables support for arm64
- Adds document color and color presentation features
- Update Roslyn to 4.5.0-2.22527.10 (PR: #2486)
- Update dotnet-script dependencies to 1.4.0 (PR: #2477)
- Register the LanguageServerLogger only once (PR: #2473)
- Fix extension not finding mono. (#5454, PR: #5484)
- Update debugger to 1.25.3. (#5460, PR: #5489)
- Fix missing fix all commands. (#5474, PR: #5475)
- Fix failure to parse sdk version and sdk path. (#2412, PR: #5459)
- Handle custom OmniSharp launch paths. (#5449, PR: #5456)
What's new in 1.25.2
Emmet support in Razor files
To enable emmet support, add the following to your settings.json:
"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}
Supported Operating Systems for Debugging
Currently, the C# debugger officially supports the following operating systems:
- X64 operating systems:
- Windows 7 SP1 and newer
- macOS 10.12 (Sierra) and newer
- Linux: see .NET Core documentation for the list of supported distributions. Note that other Linux distributions will likely work as well as long as they include glibc and OpenSSL.
- ARM operating systems:
- Linux is supported as a remote debugging target
Found a Bug?
To file a new issue to include all the related config information directly from vscode by entering the command pallette with Ctrl+Shift+P
(Cmd+Shift+P on macOS) and running CSharp: Report an issue
command. This will open a browser window with all the necessary information related to the installed extensions, dotnet version, mono version, etc. Enter all the remaining information and hit submit. More information can be found on the wiki.
Alternatively you could visit https://github.com/OmniSharp/omnisharp-vscode/issues and file a new one.
Development
First install:
- Node.js (8.11.1 or later)
- Npm (5.6.0 or later)
To run and develop do the following:
- Run
npm ci
- Run
npm run compile
- Open in Visual Studio Code (
code .
) - Optional: run
npm run watch
, make code changes - Press F5 to debug
To test do the following: npm run test
or F5 in VS Code with the "Launch Tests" debug configuration.
License
Copyright © .NET Foundation, and contributors.
The Microsoft C# extension is subject to these license terms. The source code to this extension is available on https://github.com/OmniSharp/omnisharp-vscode and licensed under the MIT license.
Code of Conduct
This project has adopted the code of conduct defined by the Contributor Covenant to clarify expected behavior in our community. For more information see the .NET Foundation Code of Conduct.
Contribution License Agreement
By signing the CLA, the community is free to use your contribution to .NET Foundation projects.
.NET Foundation
This project is supported by the .NET Foundation.