C
C#2y ago
AtomFPS

❔ external window pls

im trying to make it so when i run it, it runs on an external window
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace gettingUserInput
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello");

Console.ReadLine();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace gettingUserInput
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello");

Console.ReadLine();
}
}
}
sadly for me it only runs on VS code internal console :(
119 Replies
Hackmagician
Hackmagician2y ago
Launch the gettingUserInput.exe from your bin/Debug folder all you gotta do is build the project and it'll make that
AtomFPS
AtomFPSOP2y ago
how do i make it do that when i run the script like in VS im not sure how to explain it but this
AtomFPS
AtomFPSOP2y ago
Hackmagician
Hackmagician2y ago
shrug
AtomFPS
AtomFPSOP2y ago
what about maybe why i cant type on "OUTPUT"?
Hackmagician
Hackmagician2y ago
it's output, not a terminal if you want to type go to 'Terminal' tab at the bottom
AtomFPS
AtomFPSOP2y ago
but it runs on output not on terminal VS code is confusing w
Hackmagician
Hackmagician2y ago
you can also do dotnet run in Terminal and that'll run your app and then you can type
AtomFPS
AtomFPSOP2y ago
well the new one
Moods
Moods2y ago
Tbf You should be doing dotnet run In the terminal
AtomFPS
AtomFPSOP2y ago
freeCodeCamp.org
YouTube
C# Tutorial - Full Course for Beginners
This course will give you a full introduction into all of the core concepts in C# (aka C Sharp). Follow along with the course and you'll be a C# programmer in no time! ⭐️ Contents ⭐️ ⌨️ (0:00:00) Introduction ⌨️ (0:01:18) Installation & Setup ⌨️ (0:05:03) Drawing a Shape ⌨️ (0:17:23) Variables ⌨️ (0:30:06) Data Types ⌨️ (0:37:17) Working With S...
Hackmagician
Hackmagician2y ago
he's using Visual Studio
AtomFPS
AtomFPSOP2y ago
yes so am i
Hackmagician
Hackmagician2y ago
that's why it auto-launches the .exe on build with debugger you're using Visual Studio Code
Moods
Moods2y ago
That is not VS they are very very different
AtomFPS
AtomFPSOP2y ago
theres a difference?
Hackmagician
Hackmagician2y ago
yea
Moods
Moods2y ago
Yeah
Hackmagician
Hackmagician2y ago
Visual Studio is an IDE for .NET
AtomFPS
AtomFPSOP2y ago
w
Hackmagician
Hackmagician2y ago
and VSC is just a text editor
AtomFPS
AtomFPSOP2y ago
that explains all the problems i have so dar
Moods
Moods2y ago
You typed it twice
AtomFPS
AtomFPSOP2y ago
thanks alot! typed what twice
Moods
Moods2y ago
All the best Dw they edited it
Hackmagician
Hackmagician2y ago
that was to me
Moods
Moods2y ago
But yeah VS is a full-blown IDE
Hackmagician
Hackmagician2y ago
if you're a beginner i recommend using Visual Studio over Visual Studio Code
AtomFPS
AtomFPSOP2y ago
thanks ill download it
Hackmagician
Hackmagician2y ago
it'll let you explore with IntelliSense and suggestions, and that's how you'll learn more
ero
ero2y ago
fwiw there's a setting in the .vscode settings.json where you can specify that your program should run in an external console
AtomFPS
AtomFPSOP2y ago
VS is a hell lot larger than VS code thats prob why it took longer to download that one time
Moods
Moods2y ago
Yeah….
AtomFPS
AtomFPSOP2y ago
yh guess ill wait it out
AtomFPS
AtomFPSOP2y ago
no run?
AtomFPS
AtomFPSOP2y ago
@ℍ
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
there's this little arrow next to the button click that and select the first thing, should be something like "gettingUserInput" with a green play button
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
like this
AtomFPS
AtomFPSOP2y ago
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
this little arrow click it
AtomFPS
AtomFPSOP2y ago
then? it only shows "current file"
Hackmagician
Hackmagician2y ago
Did you open a solution? or just the files?
AtomFPS
AtomFPSOP2y ago
whats a solution
Hackmagician
Hackmagician2y ago
When you were opening it , did you click on either of these 2?
AtomFPS
AtomFPSOP2y ago
i opened a folder
Hackmagician
Hackmagician2y ago
ah that explains it in that folder, do you maybe have a file that's called gettingUserInput.sln? if you do, double click that one
AtomFPS
AtomFPSOP2y ago
no i think wait how do you get that window thing on the right cause i closed it oh nvm
AtomFPS
AtomFPSOP2y ago
/@ℍ
Hackmagician
Hackmagician2y ago
ah i see you need to make a new a solution
Hackmagician
Hackmagician2y ago
freeCodeCamp.org
YouTube
C# Tutorial - Full Course for Beginners
This course will give you a full introduction into all of the core concepts in C# (aka C Sharp). Follow along with the course and you'll be a C# programmer in no time! ⭐️ Contents ⭐️ ⌨️ (0:00:00) Introduction ⌨️ (0:01:18) Installation & Setup ⌨️ (0:05:03) Drawing a Shape ⌨️ (0:17:23) Variables ⌨️ (0:30:06) Data Types ⌨️ (0:37:17) Working With S...
Hackmagician
Hackmagician2y ago
follow from here
AtomFPS
AtomFPSOP2y ago
thanks
Hackmagician
Hackmagician2y ago
after you make the solution, in the folder where your project is located you can drop your other files that way u won't have to repeat everything
AtomFPS
AtomFPSOP2y ago
oh thanks i was worried about htat
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
oh i changed it and it works now thanks again!
Hackmagician
Hackmagician2y ago
np
AtomFPS
AtomFPSOP2y ago
@ℍ do i have to like do make a new project everytime i make a new file
Hackmagician
Hackmagician2y ago
no no
AtomFPS
AtomFPSOP2y ago
cause somehow when i tried to change the thing it executes a different file
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
you right click this and then Add > Class
AtomFPS
AtomFPSOP2y ago
?
Hackmagician
Hackmagician2y ago
keep the little arrow up top to be your Program.cs file, or the file where you have your Main, as that'll launch your whole app. you just add new files by clicking on your project and then add
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
this
Hackmagician
Hackmagician2y ago
you should open the .sln file, instead of having the folder open
Hackmagician
Hackmagician2y ago
so close out of visual studio, go to that folder and then double click this file
AtomFPS
AtomFPSOP2y ago
Hackmagician
Hackmagician2y ago
yep now in your folder
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
drag these
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
into this one 'CS4HOURCOUSE' folder that way they're in your project
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
still doing the wrong file
Hackmagician
Hackmagician2y ago
that's still your folder view instead of your actual solution file open the CS4HOURCOUSE.sln
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
its not supposed to do hello world btw
Hackmagician
Hackmagician2y ago
that's the default go to Program.cs that's where it'll say Console.WriteLine("Hello, World!");
AtomFPS
AtomFPSOP2y ago
so i modify that instead?
Hackmagician
Hackmagician2y ago
yeah ur Program.cs file
AtomFPS
AtomFPSOP2y ago
but what if i want to modify another file and run it instead of Program.cs i copy pasted the code from gettingUserInput.cs to Program.cs but its still printing hello world @ℍ
Hackmagician
Hackmagician2y ago
You need a Program.cs file with a static void Main to launch can you share screenshots
AtomFPS
AtomFPSOP2y ago
Hackmagician
Hackmagician2y ago
here are your errors: 1. lowercase program 2. Program is already defined
Hackmagician
Hackmagician2y ago
copy paste everything from here into your Program.cs file
AtomFPS
AtomFPSOP2y ago
i did
Hackmagician
Hackmagician2y ago
you didn't
AtomFPS
AtomFPSOP2y ago
smh this is Program.cs
Hackmagician
Hackmagician2y ago
im clearly looking at something else kekw
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
it isn't tho
AtomFPS
AtomFPSOP2y ago
smh wait
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
screenshot was before i pasted it lol my bad still does the same thing whatsoever
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
Program2 -> Program rename that Class and if you have another Program class, change that name to something else
AtomFPS
AtomFPSOP2y ago
AtomFPS
AtomFPSOP2y ago
from the other files?
Hackmagician
Hackmagician2y ago
go in here and rename program to something else
Hackmagician
Hackmagician2y ago
change it to like randomClass or somethin
AtomFPS
AtomFPSOP2y ago
next? it still does the same thing
Hackmagician
Hackmagician2y ago
you also have multiple Main methods like the one in here change it to something else
Hackmagician
Hackmagician2y ago
AtomFPS
AtomFPSOP2y ago
deleted those files this time fk now its working! thanks once again
Hackmagician
Hackmagician2y ago
np
AtomFPS
AtomFPSOP2y ago
but then again what if i want to like do another file do i have to create another "solution"
Hackmagician
Hackmagician2y ago
no
Hackmagician
Hackmagician2y ago
Hackmagician
Hackmagician2y ago
you would right click the little rectangle with the green "C#" in it then Add > New Item
AtomFPS
AtomFPSOP2y ago
oh thanks
Denis
Denis2y ago
Could you please share, why you have chosen to use VSCode instead of Visual Studio Community 2022? Just wondering
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?