How to Program C# in Visual Studio Code [2023]

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
you need Visual Studio it's so expensive and it only runs on Windows stop the excuses it's not true developing C sharp in Visual Studio code is simple doesn't cost anything and it provides a great cross-platform developer experience open Visual Studio code and install the c-sharp def kit extension it's the only extension that we need and provides everything we need to develop c-sharp applications after the installation the welcome screen allows you to connect your Microsoft account install the.net SDK and create new.net projects you can use the.net version command to see if you already have a net SDK installed otherwise make sure to install the current version we can use the Ctrl shift p shortcut to open the command palette the c-sharp def kit extension added new comments including the.net new project command reuse it and select the console application project type if you haven't opened a directory Visual Studio code will ask you where it should create a project we can also provide a project name the extension creates a project including a program.cs file and a solution file in the program.cs file we change the code from Hello World to hello from Visual Studio code we open a terminal and change directories into the project folder next we use the.net run command to execute the console application as you can see the text hello from Visual Studio code appears in the output let's quickly extend the example I Define an inquiryable named H and assign 32. next I print the value to the console I click on the left of the row number to set the breakpoint next I open the run and debug menu press the show all automatic debug configurations and select the console application the user interface changes and we can use the Green Run button to launch the application with a debugger attached we can navigate the code using the visual overlay or using keyboard shortcuts the context menu provides us with different options for example we can use defined all references command we can also use different shortcuts such as F2 to rename a variable in the whole code file the c-sharp dev kit provides many helpful features that enhance the developer experience if you want even more help you can install the GitHub co-pilot extension which is also available for visual studio code we can also use code Snippets that come with the c-sharp dev kit extension for example we can use the try snippet to generate a try catch code block there are additional Snippets to create classes Constructors properties and much more we can use the Ctrl T shortcut and search for code symbols for example we can jump to class as Properties or different code files it's great for a simple tutorial but does it also work for production use cases well let's create a Blazer server application using the command palette Visual Studio code generated a whole Blazer server application for us we can compile and run the web application using the.net run command let's make a few changes to the code as you can see right now they are not reflected in the browser let's stop the application and usd.net watch command instead it will launch the web application in the browser again but this time when I change the code in any Blazer component and save the file the changes are instantly reflected pretty cool right as demonstrated we can use Visual Studio code to develop modern.net applications this is sharp dev kit provides us with a command to create new projects from directly inside Visual Studio code I and it adds code Snippets and allows us to conveniently navigate to source code drop your excuses and start developing c-sharp applications with Visual Studio code if you found any value in watching this video please hit the like button and consider subscribing to learn more about net development and I'll see you in the next video
Info
Channel: Claudio Bernasconi
Views: 25,742
Rating: undefined out of 5
Keywords: C# in Visual Studio Code, C# Development, C# in VSCode, VSCode C#, C# Visual Studio Code, Programming C#, How to Program C# in Visual Studio Code, Developing C# in Visual Studio Code, VSCode for .NET Development, dotnet, dotnet in VSCode, Claudio Bernasconi
Id: 1PJ5lT4nCbM
Channel Id: undefined
Length: 5min 22sec (322 seconds)
Published: Wed Jul 12 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.