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.