vscode-csharp
vscode-csharp copied to clipboard
Official C# support for Visual Studio Code
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.1
What's new in 1.25.0
- Make SDK build of OmniSharp the default (#5120, PR: #5176)
- Add auto complete name to class, interface, enum, struct etc. snippets (PR: #5198)
- Add a fallback for ps in remoteProcessPickerScript (#4096, PR: #5207)
- Clear nullability warnings in server/omnisharp.ts (PR: #5199)
- Fix nullability for autoStart preferredPath (PR: #5192)
- coreclr debug configuration should support input variables for envFile (#5102, PR: #5189)
- Fix small spelling mistake (PR: #5215)
- Low-hanging nullable fruit (PR: #5186)
- Fire a buffer update instead of filechanged when active editor changes (#5216, PR: #5218)
- Add support for InlayHint.TextEdits (PR: #5177)
- Fix .net6 OmniSharp acquisition on Linux arm64 (PR: #5172)
- Remove project.json reference in debugger.md (PR: #5210)
- Update debugger to 1.24.5 (PR: #5211)
- Fixes #5083
- Update OmniSharp to 1.39.0 (PR: #5219)
- Update Roslyn to 4.3.0-2.22267.5 (PR: omnisharp-roslyn#2401)
- Fixed run script for Mono (#5181, #5179, PR: omnisharp-roslyn##2398)
- Fall back to /usr/lib/os-release if /etc/os-release doesn't exist (PR: omnisharp-roslyn##2380)
- Added support for linux-musl-x64 and linux-musl-arm64 (omnisharp-roslyn##2366, PR: omnisharp-roslyn##2395)
- Enable GoToDefinition for symbols in metadata documents (#4818, PR: omnisharp-roslyn##2390)
- Use human readable doc in lsp's signature help (omnisharp-roslyn##2372, PR: omnisharp-roslyn##2392)
- Add TextEdits support to InlayHints (PR: omnisharp-roslyn##2385)
- Fix Equals of AutoCompleteResponse and simplify some code (PR: omnisharp-roslyn##2362)
- Support O# running on .NET 7 SDKs (PR: omnisharp-roslyn##2377)
- Provide constructor accepting hostServices (PR: omnisharp-roslyn##2373)
- Typo fix (omnisharp-roslyn##2374)
- Update to latest .NET SDKs (PR: omnisharp-roslyn##2378)
- Remove MSBuild and Mono from release packages (omnisharp-roslyn##2339, PR: omnisharp-roslyn##2360)
What's new in 1.24.4
- Remove inlayHints from diff view (PR: #5151)
- Quote arguments containing spaces when launching OmniSharp (#5150, PR: #5154)
What's new in 1.24.3
What's new in 1.24.2
- Support inlay hints (#1932, PR: #5107)
- Pass "shell: true" as a spawn option when launching O# (PR: #5125)
- Add GoToTypeDefinition provider (#4251, PR: #5094)
- Quote launch paths when necessary (#5099, PR: #5101)
- Fix string escape for linux and unix (PR: #5122)
- Debounce diagnostic requests (#5085, PR: #5089)
- Add AnalyzeOpenDocumentsOnly (PR: #5088)
- Upgrade OmniSharp to 1.38.2:
- Add analyze open documents only (PR: omnisharp-roslyn#2346)
- Create a new GoToTypeDefinition endpoint (omnisharp-roslyn#2297, PR: omnisharp-roslyn#2315)
- Eliminate more instances of IWorkspaceOptionsProvider (PR: omnisharp-roslyn#2343)
- Update Build.md brew cask instructions (PR: omnisharp-roslyn#2355)
- Remove not used middleware extension methods and unify adding middleware (PR: omnisharp-roslyn#2340)
- Pass --overwrite when pushing build artifacts to azure (PR: omnisharp-roslyn#2358)
- Delete System.Configuration.ConfigurationManager from deployed packages (#5113, PR: omnisharp-roslyn#2359)
- Support inlay hints (PR: omnisharp-roslyn#2357)
- Update build tools to match .NET SDK 6.0.201 (omnisharp-roslyn#2363)
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.