Debug C# using Visual Studio Code

Debug C# in Visual Studio seems simple but there are tricks that you need to know. This blog shows you the trick.

The trick to debug C# in Visual Studio Code is that you need to use commands in command prompt.

1. Create a folder where you want to store your C# project.

2. Change to that folder (use the cd command if you are using command prompt).

3. Type code . (it is the word code with a dot).

4. Select the last icon on the left, the Extension icon.


5. You will see the C# for Visual Studio Code in the list. Scroll further down if you cannot see it on top. Click Install.


After installed you will either click Reload or click the OK in the pop up Window to restart Visual Studio Code.



6. Install the .NET Core SDK. Go to the.NET Core home page . Choose the operating system platform. Choose the Download .NET Core. When I am writing this the version of .NET Core is version 1.1 but it may upgrade to the later version when you are doing it.


Once the installation is completed. The below is the important steps.

7. Go to the command prompt (cmd). Go to the folder that you created in the step 1.

8. Type dotnet new.

The SDK will create the project structure for you.

9. Type dotnet restore.

The SDK will now pull down the dependencies from the Internet for you if there is any.

10. Type dotnet run.

The SDK will Build and Run the simple Hello World program it has created when you type dotnet new.

Back to Visual Studio Code, you might see Required assets to build and debug are missing from “yourfolder name” Add item? Click Yes.


12. You can click the debug now. Configure the debug using .NET Core and click run.




About chanmingman

Since March 2011 Microsoft Live Spaces migrated to Wordpress ( till now, I have is over 1 million viewers. This blog is about more than 50% telling you how to resolve error messages, especial for Microsoft products. The blog also has a lot of guidance teaching you how to get stated certain Microsoft technologies. The blog also uses as a help to keep my memory. The blog is never meant to give people consulting services or silver bullet solutions. It is a contribution to the community. Thanks for your support over the years. Ming Man is Microsoft MVP since year 2006. He is a software development manager for a multinational company. With 25 years of experience in the IT field, he has developed system using Clipper, COBOL, VB5, VB6, VB.NET, Java and C #. He has been using Visual Studio (.NET) since the Beta back in year 2000. He and the team have developed many projects using .NET platform such as SCM, and HR based applications. He is familiar with the N-Tier design of business application and is also an expert with database experience in MS SQL, Oracle and AS 400.
This entry was posted in .Net, Community and tagged , , , , , . Bookmark the permalink.

One Response to Debug C# using Visual Studio Code

  1. Pingback: Using node.js as a web server with Visual Studio Code | Chanmingman's Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s