0

I have just installed VS Community Edition, and tried to run simple I/O code, but vs just skips the part where I have to input some informations as user:

using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LetsGetStarted
{
    static class Program
    {
    
        static void Main()
        {
            Console.WriteLine("Random stuff that do get executed by program.");
            string example = Console.ReadLine(); //this part is just skipped
            Console.ReadLine(); //this part is just skipped
        } 
    }    
}

This is what it says and as you can see it skipps Console.ReadLine(), and never lets me input anything. I searched for things like: "how to run C# in vs community edition", but just found about vs code (which is not same). Everything seems to work fine except when I have to input something. Why doesn't it let me interact with the console, and how can I fix it so that I can interact with console? And also how can I run it so that terminal pops up, without me specifying ./directory(or something like that)? Thanks in advance!!!

Legendary
  • 1
  • 1
  • 1
    VS Code has stable and insiders editions. Visual Studio has a Community Edition. Are you sure you are using VS Code? [VS Code](https://code.visualstudio.com/) vs [Visual Studio](https://visualstudio.microsoft.com/) – crashmstr Feb 08 '21 at 15:05
  • That output window looks like the one of Visual Studio, not Visual Studio Code - those are two very different programs – UnholySheep Feb 08 '21 at 15:05
  • I followed this tuto to install it https://www.youtube.com/watch?v=1uBESL2S8Ik – Legendary Feb 08 '21 at 15:08
  • 1
    It seem you are programming in a Windows Forms project, not a Console project. You should use a console application for this. The output debug window is not a console. – JHBonarius Feb 08 '21 at 15:10
  • Where can I check that, and can I change it in vs so even if I runed it in a Windows Forms project, can I switch in Console project without havint to copy, paste it on new page. – Legendary Feb 08 '21 at 15:14
  • I think I found what you meant: went to properties and made it Console Application, thak you all it finally worked. – Legendary Feb 08 '21 at 15:25
  • 1
    If you want to do it right, create a new Console project and copy your code over. There are a lot of different things between a Windows app and a Console app. Copying your code over would be the easiest thing to do (by far) – Flydog57 Feb 08 '21 at 15:26

0 Answers0