4

Possibly a repeat or very basic question...

I have recently downloaded Visual Studio Code on Windows and tried to open my existing "Hello World!!" console application.

I have downloaded the C# extension for the same.

Could you please point me to documentation where I can find step-by-step guide for configuring VS Code so that I can open existing console app and debug/ run the same.

Currently when I opened my existing C# project written using VS2013 and tried to debug/ run, it is not working. I'm getting following error. "The preLaunchTask 'build' terminated with exit code 1."

Or am I trying to do something which is not correct at all??

3
  • share your code so may we can help you Commented Sep 26, 2016 at 4:58
  • The C# code has only basic program.cs file which has Console.Writeline("Hello World"). Which file you would like to see? Sorry to ask, but too new for VS Code...Or shall I share the launch.json.. Commented Sep 26, 2016 at 5:01
  • try first open VS Code and then give him path of your application by File>Open.... is first time when you write code was working ? Commented Sep 26, 2016 at 5:14

5 Answers 5

7

The Answer is NO

VS Code does not support debugging applications running on the Desktop .NET Framework.

VS Code is optimized for cross-platform .NET Core development Due to this focus, many standard C# project types are not recognized by VS Code.

A non-supported project type is an

  • ASP.NET MVC Application
  • Console application
  • WPF
  • Anything on Desktop .NET Framework.

VS Code supports debugging of C# applications running on either .NET Core or Mono

VS Code only supports a limited set of project types (primarily .NET Core). For full .NET project support, use Visual studio community

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks... that clarifies my doubt.
5

The answer is No

First things first - VS 2013 and VS code are 2 different IDEs .

Visual Studio Code - is a source code editor developed by Microsoft for Windows, Linux and OS X. It includes support for debugging, embedded Git control, syntax highlighting, intelligent code completion, snippets, and code refactoring.

You cannot open VS 2013 projects in VS code.

I would suggest -See some tutorial on using VS Code IDE. here's the link Getting Started

Also here's the link for the question asked Console application using C#

Hope this helps

3 Comments

thanks.. So can I assume that I cannot edit/ run the existing solution which is created in VS2013 in VS Code?
@Anand Generally, no. Some type of projects sometimes with modification may be opened in VS Code, but don't expect most type to be usable in VS Code.
yes, there is no option like file -> open project -> console etc. etc.
1

to build your own Console Application with .NET Core folow this path:

  1. create the project folder
  2. go to the folder created
  3. On a CMD (Windows) or Terminal (Linux) tap - "dotnet console"
  4. Tap the command "dotnet restore" to restore dependecies for the projet

That's it! Your console application project is ready to be edited! To see it runnin tap "dotnet run"!!!

You can debug your code in "Debug" painel (select it at the left side bar menu).

I hope it was helpfull.

Comments

0

Try This

using System; namespace HelloWorld { class Hello { static void Main() { Console.WriteLine("Hello World!"); // Keep the console window open in debug mode. Console.WriteLine("Press any key to exit."); Console.ReadKey(); } } } 

Comments

0

You can use .NET Core. Here are some instructions to run a basic C# console app in Visual Studio Code.

  1. Download Visual Studio Code and install it.
  2. Go to the Extensions, download the C# extension.

enter image description here

  1. Download .NET Core here and install it. https://dotnet.microsoft.com/download

  2. Open command prompt, and change to the folder where you want to create your app.

  3. Run:

dotnet new console -o myapp

Replace myapp with your app name.

  1. Go to Visual Studio Code, and open the folder you just created (example: myapp)

  2. Open the program.cs file, this is your main code.

enter image description here

  1. Click on Run to run your code.

enter image description here

  1. You will see your code output in the Console window at the bottom:

enter image description here

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.