C
C#2mo ago
Triceracop

Need Help Setting Up C# on VsCode

idk wtf im doing, online tutorials don't really help. I can't run the file I created.
81 Replies
Triceracop
Triceracop2mo ago
Got this far 👍
Angius
Angius2mo ago
What "run file"? And created how?
Triceracop
Triceracop2mo ago
i uh
MaybeJon
MaybeJon2mo ago
Julio Casal
YouTube
VS Code Tutorial For C# Developers
💻Get the source code: https://go.dotnetacademy.io/vscodetutorial A step-by-step tutorial on how to get started building C# applications with Visual Studio Code, the lightweight but powerful source code editor that everybody is using today and that now also features impressive AI capabilities thanks to GitHub Copilot. 🔥Become a Senior C# Backen...
Triceracop
Triceracop2mo ago
dont understand what you are asking
MaybeJon
MaybeJon2mo ago
Watch that video at 1.5x speed
Triceracop
Triceracop2mo ago
thanks bro ill check it out Been going through it, but I got stuck on debugging.
Angius
Angius2mo ago
You need to open the project Not the folder
Triceracop
Triceracop2mo ago
Is this not the project I should press f5 on?
Angius
Angius2mo ago
Your project is in MyWebApi folder So open that folder
Triceracop
Triceracop2mo ago
yup
Angius
Angius2mo ago
Yeah Not the C#_Shit one Or whatever other folder there is anywhere above
Triceracop
Triceracop2mo ago
well myWebApi is in C#_Shit
Angius
Angius2mo ago
So?
Triceracop
Triceracop2mo ago
sooo how would I not open c sharp shit anyway besides the point i have myWebApi open
Angius
Angius2mo ago
Just... open VS in the folder with the project Not in any other folder Not in the root of your C:// drive
Triceracop
Triceracop2mo ago
im actually sorry if what im saying is complete bullshit but is this not open
Angius
Angius2mo ago
The folver above is open
Triceracop
Triceracop2mo ago
closed it gotcha
Angius
Angius2mo ago
VS is looking for a .csproj file directly in the folder you have opened It doesn't search for it recursively You can maybe manually point it to a given .csproj or .sln file, idk But by default, it only searches in the root
Triceracop
Triceracop2mo ago
hmmmm I mean that makes sense to ne but I cant debug the .csproj
Angius
Angius2mo ago
?
Triceracop
Triceracop2mo ago
so im trying to open the .cs and debug in the MyWebApi folder but it just says that it isnt loaded should I get that then?
Angius
Angius2mo ago
The project isn't loaded because the project file is not in the top-level And you don't debug the project file Set your breakpoints or whatever in the source files Then run the debugger
Triceracop
Triceracop2mo ago
which ones are the source files
Angius
Angius2mo ago
.cs
Triceracop
Triceracop2mo ago
vs code aint caring
Angius
Angius2mo ago
Do you have the proper folder open yet?
Triceracop
Triceracop2mo ago
yes?? MyWebApi on Visualstudio code with all my stuff in it
Angius
Angius2mo ago
That is the top-level folder you have opened? Not some /Foo/Bar/Baz/MyCoolFiles/MyWebApi?
Triceracop
Triceracop2mo ago
lol sorry was laughing at that thats what my workspace looks like rn
Angius
Angius2mo ago
Okay
Triceracop
Triceracop2mo ago
only thing open
Angius
Angius2mo ago
So I'll come back once you listen to the very first thing I told you to do Until then I'll be chekcing out
Triceracop
Triceracop2mo ago
dude i dont understand how Im not suppose to have anything else open but that because its in it
Angius
Angius2mo ago
Close VS Code Open file explorer Go to the folder where your .csproj is Right-click anywhere Click "Open with VS Code"
Triceracop
Triceracop2mo ago
alright that has been done bro im sorry I dont understand
Angius
Angius2mo ago
Which part?
Triceracop
Triceracop2mo ago
the fact that like you want me to close the top folders but my project is in those folders like c#_shit, but Its just where I have the project
Angius
Angius2mo ago
I told you But I can repeat VS Code looks for the project file in the TOP LEVEL and TOP LEVEL only If it cannot find anything there, it takes a shit on the floor and dies
Triceracop
Triceracop2mo ago
alright ill just make MyWebApi its own folder and take it out of c#Shit
Angius
Angius2mo ago
Or you can just open that folder...? You know that you can open just MyStuff instead of Foo/Bar/Baz/Quz/MyStuff?
Triceracop
Triceracop2mo ago
no i did not anyway
Angius
Angius2mo ago
"This has been done" my ass
Triceracop
Triceracop2mo ago
????/ THAT OPENS THE c#SHIT because thats literally its file location
Angius
Angius2mo ago
Interesting, because I found this random project here, on my PC Then I right-clicked to open with Code And it opened just that
Triceracop
Triceracop2mo ago
This? is that what I needed to do this whole time
Angius
Angius2mo ago
What you needed is to open the project directory
Triceracop
Triceracop2mo ago
see now that makes sense I mean ima have to look up to do that but those words sounds like they can fix the problem
Angius
Angius2mo ago
Alternatively, I have another solution Throw VS Code into the garbage where it belongs Download VS 2022 Use that
Triceracop
Triceracop2mo ago
didnt know that existed wait whats the main difference between the two
Angius
Angius2mo ago
VS Code sucks ass at doing C# VS does not VS sucks ass at any other language besides C# and maybe F#
Triceracop
Triceracop2mo ago
ooooo
Angius
Angius2mo ago
VS Code does not
Triceracop
Triceracop2mo ago
ya see I come from my humble python background' but ill download vs which one
Angius
Angius2mo ago
Community
Triceracop
Triceracop2mo ago
gotcha
Angius
Angius2mo ago
It's the free one
Triceracop
Triceracop2mo ago
alright its downloading Now ima do my best to try and get c# to work on this before asking you monkey brain questions
Angius
Angius2mo ago
With VS installed there isn't much getting it to work You open VS, make a new project, there Done, works
Triceracop
Triceracop2mo ago
just a single file?
Angius
Angius2mo ago
No, not a single file
Triceracop
Triceracop2mo ago
aw hey but if it works how do I install c# on VS? cant find it in the extensions
Angius
Angius2mo ago
No need to install any extensions Just make sure you have the ASP workload installed Seeing how you want to make an API
Triceracop
Triceracop2mo ago
Actually dont know shit about API's
Angius
Angius2mo ago
It should've prompted you during installation, but if not, just run VS installer
Triceracop
Triceracop2mo ago
just following along with a tutorial about making a project and it didnt go well
Angius
Angius2mo ago
Then select "modify" next to your version of VS And give the ASP worload a checkmark
Triceracop
Triceracop2mo ago
alright what would I click then if I just want to make something to run something to output text on the modify page
Angius
Angius2mo ago
Classic apps for .NET platform, or something like that It covers WPF, Winforms, and console apps
Triceracop
Triceracop2mo ago
so i wouldnt need ASP?
Angius
Angius2mo ago
No need ASP.NET Core is a web framework If you're not doing anything web, you don't need support for it in your IDE
Triceracop
Triceracop2mo ago
dat?
Angius
Angius2mo ago
Yeah
Triceracop
Triceracop2mo ago
alr cool waiting for theses packages to download bam look at me go
Angius
Angius2mo ago
Nice
Triceracop
Triceracop2mo ago
now I press ctrl + F5 to debug but I dont get a hello world output on the terminal
Angius
Angius2mo ago
Add Console.ReadLine() right after see if that works
Triceracop
Triceracop2mo ago
oh wait nah i just didnt see it Sucess time to write master code now off to make millions
Angius
Angius2mo ago
Good luck lol
Triceracop
Triceracop2mo ago
thanks like honestly