The C# support in Visual Studio Code is optimized for cross-platform .NET Core development (see working with .NET Core and VS Code for another relevant article). Our focus with VS Code is to be a great editor for cross-platform C# development.
VS Code supports debugging of C# applications running on either .NET Core or Mono.
For detailed instructions on:
C (/ s iː /, as in the letter c) is a general-purpose, procedural computer programming language supporting structured programming, lexical variable scope, and recursion, with a static type system. By design, C provides constructs that map efficiently to typical machine instructions. Open Visual Studio 2017. From the top menu bar, choose File New Project. In the New Project dialog box in the left pane, expand Visual C#, expand Web, and then choose.NET Core.In the middle pane, choose ASP.NET Core Web Application.Then, name the file MyCoreApp and choose OK. Add a workload (optional) If you don't see the ASP.NET Core Web Application project template, you can get it.
- .NET Core debugging - see the Microsoft C# extension's GitHub page.
- Mono debugging - see the Mono Debug extension's README.
Note:VS Code has limited support for debugging applications running on the Desktop .NET Framework.
Due to this focus, many standard C# project types are not recognized by VS Code. An example of a non-supported project type is an ASP.NET MVC Application (though ASP.NET Core is supported). In these cases, if you want to have a lightweight tool to edit a file - VS Code has you covered. If you want the best possible experience for those projects and development on Windows in general, we recommend you use Visual Studio Community.
Installing C# support
C# language support is an optional install from the Marketplace. You can install it from within VS Code by searching for 'C#' in the Extensions view (⇧⌘X (Windows, Linux Ctrl+Shift+X)) or if you already have a project with C# files, VS Code will prompt you to install the extension as soon as you open a C# file.
Roslyn and OmniSharp
C# Visual Studio Code Hello World
Visual Studio Code uses the power of Roslyn and OmniSharp to offer an enhanced C# experience. We offer support for:
- .NET Core projects
- MSBuild projects
- C# scripts (CSX)
On startup the best matching projects are loaded automatically but you can also choose your projects manually. The status bar will show what projects have been loaded and also allows you to select a different set of projects. To do so, click on the status bar projects item and select Change projects…. In the image below a single project has been picked up:
The available options include:
- Selecting a
project.jsonfile will open a .NET Core project and VS Code will load that project plus the referenced projects.
- Selecting a
*.slnfile opens a MSBuild-project. It will load the referenced
*.csprojprojects and sibling or descendant
project.jsonfiles but no other project files that are referenced from the solution file.
- Selecting a
folderwill make VS Code scan for
*.csxfiles (C# scripts) and VS Code will attempt to load them all.
Once the project is loaded the enhanced experiences light up..
There is a lot to discover with C# and the editor, such as format on type, IntelliSense, the rename-refactoring, etc.
For a full description of our editing features, go to the Basic Editing and Code Navigation documentation.
Here are a few highlights..
IntelliSense just works: hit ⌃Space (Windows, Linux Ctrl+Space) at any time to get context specific suggestions.
Snippets for C#
We have several built-in snippets included in VS Code that will come up as you type or you can press ⌃Space (Windows, Linux Ctrl+Space) (Trigger Suggest) and we will give you a context specific list of suggestions.
Tip: You can add in your own User Defined Snippets for C#. Take a look at User Defined Snippets to find out how.
Search for Symbols
There are also features outside the editor. One is the ability to search for symbols from wherever you are. Hit ⌘T (Windows, Linux Ctrl+T), start typing, and see a list of matching C# symbols. Select one and you'll be taken straight to its code location.
Another cool feature is the ability to see the number of references to a method directly above the method. Click on the reference info to see the references in the Peek view. This reference information updates as you type.
Note: Methods defined in
object, such as
hashCode do not get reference information due to performance reasons.
Tip: You can turn off references information displayed in CodeLens with the
Find References/Peek Definition
You can click on the references of an object to find the locations of its use in place without losing context. This same experience works in reverse where you can Peek the definition of an object and see it inline without leaving your location.
Quick Fixes / Suggestions
There are some basic quick fixes supported in VS Code. You will see a lightbulb and clicking on it, or pressing ⌘. (Windows, Linux Ctrl+.) provides you with a simple list of fixes/suggestions.
Read on to find out about:
- .NET Core Development - get up and running with cross-platform .NET
- Basic Editing - Learn about the powerful VS Code editor.
- Tasks - Use tasks to build your project and more.
- Debugging - Find out how to use the debugger with your project.
- Unity development - Learn about using VS Code with your Unity projects.
My Project won't load
VS Code only supports a limited set of project types (primarily .NET Core). For full .NET project support, we suggest you use Visual Studio Community.
IntelliSense is not working
This is typically as a result of the current project type not being supported. You can see an indication in the OmniSharp flame in the bottom left hand side of the status bar.
How do I build/run my project?
VS Code supports tasks for build and natively understand the output of MSBuild, CSC, XBuild. Find out more in the Tasks documentation.
I'm missing required assets to build and debug C# in VS Code. My debugger says 'No Configuration'
The Visual Studio Code C# extension can generate the assets you need to build and debug. If you missed the prompt when you first opened a new C# project, you can still perform this operation through the Command Palette (View > Command Palette) by typing '.NET', and running .NET: Generate Assets for Build and Debug. This command will generate the necessary
tasks.json configuration files (under the
Sequence diagram in uml online. C or Do is the first note of the C majorscale, the third note of the A minor scale (the relative minor of C major), and the fourth note (F, A, B, C) of the Guidonian hand, commonly pitched around 261.63 Hz. The actual frequency has depended on historical pitch standards, and for transposing instruments a distinction is made between written and sounding or concert pitch.
In English the term Do is used interchangeably with C only by adherents of fixed-Do solfège; in the movable Do system Do refers to the tonic of the prevailing key.
C# Visual Studio Code Formatter
Historically, concert pitch has varied. For an instrument in equal temperament tuned to the A440 pitch standard widely adopted in 1939, middle C has a frequency around 261.63 Hz (for other notes see piano key frequencies). Scientific pitch was originally proposed in 1713 by French physicist Joseph Sauveur and based on the numerically convenient frequency of 256 Hz for middle C, all C's being powers of two. After the A440 pitch standard was adopted by musicians, the Acoustical Society of America published new frequency tables for scientific use. A movement to restore the older A435 standard has used the banners 'Verdi tuning', 'philosophical pitch' or the easily confused scientific pitch.
Middle C (the fourth C key from left on a standard 88-key piano keyboard) is designated C4 in scientific pitch notation, and c′ in Helmholtz pitch notation; it is note number 60 in MIDI notation.
While the expression Middle C is generally clear across instruments and clefs, some musicians naturally use the term to refer to the C note in the middle of their specific instrument's range. C4 may be called Low C by someone playing a Western concert flute, which has a higher and narrower playing range than the piano, while C5 (523.251 Hz) would be Middle C. This technically inaccurate practice has led some pedagogues to encourage standardizing on C4 as the definitive Middle C in instructional materials across all instruments.
Hello World C# Visual Studio Code
On the Grand Staff, middle-C is notated with a ledger line above the top line of the bass staff or below the bottom line of the treble staff. Alternatively, it is written on the centre line of a staff using the alto clef, or on the fourth line from the bottom, or the second line from the top, of staves using the tenor clef.
In vocal music, the term High C (sometimes less ambiguously called Top C) can refer to either the soprano's C6 (1046.502 Hz; c′′′ in Helmholtz notation) or the tenor's C5; both are written as the C two ledger lines above the treble clef but the tenor voice sings an octave lower. The term Low C is sometimes used in vocal music to refer to C2 because this is considered the divide between true basses and bass-baritones: a basso can sing this note easily, whereas other male voices, including bass-baritones, typically cannot.
Tenor C is an organ builder's term for small C or C3 (130.813 Hz), the note one octave below Middle C. In stoplists it usually means that a rank is not full compass, omitting the bottom octave.
Designation by octave
|Scientific designation||Helmholtz designation||Octave name||Frequency (Hz)||Other names||Audio|
|C−1||C͵͵͵ or ͵͵͵C or CCCC||Octocontra||8.176||Play|
|C0||C͵͵ or ͵͵C or CCC||Subcontra||16.352||Play|
|C1||C͵ or ͵C or CC||Contra||32.703||Play|
|C2||C||Great||65.406||Low C, cello C, 8' C (see organ pipe length)||Play|
|C3||c||Small||130.813||4' C or tenor C (organ), viola C||Play|
|C5||c′′||Two-lined||523.251||Treble C, high C (written an octave higher for tenor voices)||Play|
|C6||c′′′||Three-lined||1046.502||High C (soprano)||Play|
|C7||c′′′′||Four-lined||2093.005||Double high C||Play|
|C8||c′′′′′||Five-lined||4186.009||Eighth octave C, triple high C||Play|
|C9||c′′′′′′||Six-lined||8372.018||Quadruple high C||Play|
|C10||c′′′′′′′||Seven-lined||16744.036||Quintuple high C||Play|
Note that for a classical piano and musical theory, the middle C is usually labelled as C4; However, in the MIDI standard definition (like the one used in Apple's GarageBand), this middle C (261.626 Hz) is labelled C3. In practice, a MIDI software can label middle C (261.626 Hz) as C3-C5, which can cause confusion, especially for beginners.
C# Visual Studio Code Examples
Common scales beginning on C
C# Forms App In Visual Studio Code
- C Major: C D E F G A B C
- C Natural Minor: C D E♭ F G A♭ B♭ C
- C Harmonic Minor: C D E♭ F G A♭ B C
- C Melodic Minor Ascending: C D E♭ F G A B C
- C Melodic Minor Descending: C B♭ A♭ G F E♭ D C
- C Ionian: C D E F G A B C
- C Dorian: C D E♭ F G A B♭ C
- C Phrygian: C D♭ E♭ F G A♭ B♭ C
- C Lydian: C D E F♯ G A B C
- C Mixolydian: C D E F G A B♭ C
- C Aeolian: C D E♭ F G A♭ B♭ C
- C Locrian: C D♭ E♭ F G♭ A♭ B♭ C
Jazz melodic minor
- C Ascending Melodic Minor: C D E♭ F G A B C
- C Dorian ♭2: C D♭ E♭ F G A B♭ C
- C Lydian Augmented: C D E F♯ G♯ A B C
- C Lydian Dominant: C D E F♯ G A B♭ C
- C Mixolydian ♭6: C D E F G A♭ B♭ C
- C Locrian ♮2: C D E♭ F G♭ A♭ B♭ C
- C Altered: C D♭ E♭ F♭ G♭ A♭ B♭ C
- ^'MIDI Note/Key Number Chart', computermusicresource.com
- ^Large, John (February 1981). 'Theory in Practice: Building a Firm Foundation'. Music Educators Journal. 32: 30–35.
- ^Harold C. Schonberg (November 4, 1979). 'Birgit Nilsson – The Return of a Super-Soprano'. The New York Times.
- ^'The Note That Makes Us Weep' by Daniel J. Wakin, The New York Times, September 9, 2007