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.
Starting with C# extension version 1.24.0, there is now an option to use build of OmniSharp that runs on the .NET 6 SDK. This build requires that the .NET 6 SDK be installed and does not use Visual Studio MSBuild tools or Mono. It only supports newer SDK-style projects that are buildable with dotnet build
. Unity projects and other Full Framework projects are not supported.
To use the .NET 6 build, set omnisharp.useModernNet
to true
in your VS Code settings and restart OmniSharp.
The .NET 3.1.4xx SDKs require version 16.7 of MSBuild.
For MacOS and Linux users who have Mono installed, this means you will need to set omnisharp.useGlobalMono
to never
until a version of Mono ships with MSBuild 16.7.
You can also use the .NET 6 build of OmniSharp which runs on the .NET 6 SDK. See instructions above.
The .NET 5 SDK requires version 16.8 of MSBuild.
For Windows users who have Visual Studio installed, this means you will need to be on the latest Visual Studio 16.8 Preview.
For MacOS and Linux users who have Mono installed, this means you will need to set omnisharp.useGlobalMono
to never
until a version of Mono ships with MSBuild 16.8.
You can also use the .NET 6 build of OmniSharp which runs on the .NET 6 SDK. See instructions above.
The .NET 6 SDK requires version 16.10 of MSBuild.
For Windows users who have Visual Studio installed, this means you will need to have Visual Studio 16.11 or newer installed.
For MacOS and Linux users who have Mono installed, this means you will need to set omnisharp.useGlobalMono
to never
until a version of Mono ships with MSBuild 16.10.
You can also use the .NET 6 build of OmniSharp which runs on the .NET 6 SDK. See instructions above.
- Upgrade OmniSharp to 1.38.0 (PR: #4961)
- Build OmniSharp servers that run on .NET 6 SDK (PR: omnisharp-roslyn#2291)
- Allow net6 build of O# to load newer .NET SDKs (PR: omnisharp-roslyn#2308)
- Allow alternate versions of documents to be Semantically Highlighted (PR: omnisharp-roslyn#2304)
- Pass the logger for loading projects. So errors occur in loading projects can be printed out. (#4832, PR: omnisharp-roslyn#2288)
- Update OmniSharp.Cake dependencies (PR: omnisharp-roslyn#2280)
- Ensure each published platform uses matching hostfxr library (PR: omnisharp-roslyn#2272)
- Produce an Arm64 build for Linux (PR: omnisharp-roslyn#2271)
- Use 6.0.100 SDK for building (PR: omnisharp-roslyn#2269)
- Added Code of Conduct (PR: omnisharp-roslyn#2266)
- Improved Cake/CSX info messages (PR: omnisharp-roslyn#2264)
- Send document buffer when semantically highlighting old document versions (PR: #4915)
- Improved Regex syntax highlighting (PR: #4902)
- .NET 6 bug fixes (#4931, PR: #4950)
- Add File-scoped namespace snippet (PR: #4948)
- Add searchNuGetOrgSymbolServer documentation (PR: #4939)
- Fix 'watch' Task (PR: #4932)
- Support using .NET 6 OmniSharp (PR: #4926)
- Rename LaunchTarget.kind to not conflict with VSCode separators. (#4907, PR: #4914)
- Label optional dependencies as external (PR: #4905)
- Provide a friendly name for the Razor language (PR: #4904)
- Update Debugger to 1.23.19 (PR: 4899)
- Add targetArch to Attach and documentation (#4900, PR: #4901)
- Allow Linux Arm64 users to run the experimental O# build (PR: #4892)
-
Greatly improved download experience: when the C# extension is downloaded from the VS Code Marketplace, it will include all of its dependencies already (#4775)
-
Fix typo in Readme.md (PR: #4819)
-
Fix indentation level and spacing for xUnit fact snippet. (PR: #4831)
-
Support relative paths with omnisharp.testRunSettings (PR: #4860) (PR: #4849)
-
Add
CimAttachItemsProvider
to replaceWmicAttachItemsProvider
(PR: #4848) -
Enhance sourceFileMap documentation (PR: #4844)
-
Update the indentation level and spacing for the '"xUnit Test" fact' snippet. (PR: #4831)
-
Debugger changes:
-
Update OmniSharp version to 1.37.17:
- Update versions to match dotnet SDK 6.0.1xx (PR: omnisharp-roslyn#2262)
- Remove all completion commit characters in suggestion mode. (omnisharp-roslyn#1974, omnisharp-roslyn#3219, omnisharp-roslyn#3647, omnisharp-roslyn#4833, PR: omnisharp-roslyn#2253)
- fixed logging interpolation in ProjectManager (PR: omnisharp-roslyn#2246)
- Support signature help for implicit object creation (omnisharp-roslyn#2243, PR: omnisharp-roslyn#2244)
- Implement /v2/gotodefinition for Cake (omnisharp-roslyn#2209, PR: omnisharp-roslyn#2212)
- Show decompilation authorization once per install. (#3982, PR: #4760)
- Launch with first Folder or Solution target found (PR: #4780)
- Update Debugger Labels (PR: #4798)
- Add Debug Welcome View (PR: #4797)
- Update OmniSharp version to 1.37.16:
- Update included Build Tools to match .NET SDK 6 (PR: omnisharp-roslyn#2239)
- Add Custom .NET CLI support to OmniSharp (PR: omnisharp-roslyn#2227)
- Handle .editorconfig changes without running a new design time build (omnisharp-roslyn#2112 PR: omnisharp-roslyn#2234)
- Do not return nulls when getting documents by path (omnisharp-roslyn#2125 PR: omnisharp-roslyn#2233)
- handle RecordStructName in semantic highlighting classification (omnisharp-roslyn#2228 PR: omnisharp-roslyn#2232)
- Update CodeStructureService with FileScoped Namespace support (omnisharp-roslyn#2225 PR: omnisharp-roslyn#2226)
To enable emmet support, add the following to your settings.json:
"emmet.includeLanguages": {
"aspnetcorerazor": "html"
}
The C# semantic highlighting support is in preview. To enable, set editor.semanticHighlighting.enabled
and csharp.semanticHighlighting.enabled
to true
in your settings. Semantic highlighting is only provided for code files that are part of the active project.
To really see the difference, try the new Visual Studio 2019 Light and Dark themes with semantic colors that closely match Visual Studio 2019.
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
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.
First install:
- Node.js (8.11.1 or later)
- Npm (5.6.0 or later)
To run and develop do the following:
- Run
npm i
- 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.
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.
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.
By signing the CLA, the community is free to use your contribution to .NET Foundation projects.
This project is supported by the .NET Foundation.