C
C#17mo ago
♫Woozy♫

I can't even run my code.

Hi! I'm trying to start learning C# in visual studio community but my visual studio just doesn't look the same as the people in youtube tutorials. I can't even press F5 to run a simple Hello World... Any idea on what might be the problem?
46 Replies
Pobiega
Pobiega17mo ago
It looks like you don't have any projects added to your solution. Did you perhaps open a .cs file directly inside VS instead of opening the .csproj? C# is project based, so you must open a project file
♫Woozy♫
♫Woozy♫OP17mo ago
it says Program.cs in the top left should it say .csproj instead there?
Pobiega
Pobiega17mo ago
No, I just think you opened the wrong file when you started Visual Studio as said, C# is project based its not like python or JS where you can run an individual file
♫Woozy♫
♫Woozy♫OP17mo ago
When I launch vscommunity i press the create a new project
♫Woozy♫
♫Woozy♫OP17mo ago
♫Woozy♫
♫Woozy♫OP17mo ago
then chose Console App
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
Okay, seems good
♫Woozy♫
♫Woozy♫OP17mo ago
♫Woozy♫
♫Woozy♫OP17mo ago
i use net 6.0, it's the standard option
Pobiega
Pobiega17mo ago
No reason not to use 7.0, but thats a minor issue
♫Woozy♫
♫Woozy♫OP17mo ago
and when it opens i get this:
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
hm okay thats not how its supposed to look if you look top right, you see it says "0 projects"
♫Woozy♫
♫Woozy♫OP17mo ago
yeah
Pobiega
Pobiega17mo ago
okay lets try doing it via the terminal open up a command prompt or terminal and navigate to where you want the code to be
♫Woozy♫
♫Woozy♫OP17mo ago
how do I do that?
Pobiega
Pobiega17mo ago
WIN+R and type "cmd"
♫Woozy♫
♫Woozy♫OP17mo ago
oooh aight, then?
Pobiega
Pobiega17mo ago
well, where do you want the code to be on your computer? Im guessing your prompt says something like C:\Users\<yourusername>
♫Woozy♫
♫Woozy♫OP17mo ago
don't i write the code in visual studio community yeah it does
Pobiega
Pobiega17mo ago
Are you aware of how the computer stores files on your harddrives? your code is files. on your harddrives.
♫Woozy♫
♫Woozy♫OP17mo ago
ooh yeah
Pobiega
Pobiega17mo ago
I keep all my code in D:\Code, but if you dont have a second drive you can just put it on C
♫Woozy♫
♫Woozy♫OP17mo ago
yeah i just have an ssd so it all gets stored on my ssd C drive
Pobiega
Pobiega17mo ago
okay great so lets do cd .. twice then mkdir code then cd code
♫Woozy♫
♫Woozy♫OP17mo ago
done
Pobiega
Pobiega17mo ago
and your prompt says C:\code now?
♫Woozy♫
♫Woozy♫OP17mo ago
yes
Pobiega
Pobiega17mo ago
great then do dotnet new console -n MyTestProject
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
oooh you dont have any SDKs installed lets verify do dotnet --info and show me what it says
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
two dashes
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
Ah, you have installed an x86 version lets swap to the x64
♫Woozy♫
♫Woozy♫OP17mo ago
how do i do that?
Pobiega
Pobiega17mo ago
are you able to screenshare?
♫Woozy♫
♫Woozy♫OP17mo ago
yeah :)
Pobiega
Pobiega17mo ago
its a bit tricky to explain over text #dev-vc-1 $helloworld
Pobiega
Pobiega17mo ago
👻
♫Woozy♫
♫Woozy♫OP17mo ago
Tja. Behöver jag ha med "private static void" grejen och internal class program i min kod? för det är något error med internal class Program står det
♫Woozy♫
♫Woozy♫OP17mo ago
Pobiega
Pobiega17mo ago
English only in written channels. You seem to have two Program classes in the same namespace thats not allowed and the declaring of a class and main method CAN be skipped, but I recommend against it as a beginner since thats unique to just the main method, everwhere else you still need to make classes
♫Woozy♫
♫Woozy♫OP17mo ago
Hi! I got help from some people in vc with the program issue and it's fixed now. I'll look up a tutorial on how to declare it :)
Want results from more Discord servers?
Add your server