C
C#ā€¢4mo ago
Jimjam#9770

How do I run/start my code?

I've practically only ever used Python, so I'm unsure how to run this code on Visual Studio Code? Sorry if this is really basic, I just genuinely am so stressed because I need to get this done asap (rocky) and I'm just a bit stuck right now šŸ˜­
No description
60 Replies
leowest
leowestā€¢4mo ago
C# is not python u can't just create a file and run it, it works based on project, so you create a project and run it, $vscode
MODiX
MODiXā€¢4mo ago
Follow the instructions here on getting started with DevKit for C# in VSCode: https://code.visualstudio.com/docs/csharp/get-started
Get started with C# and .NET in Visual Studio Code
Getting Started with C# and .NET Development in Visual Studio Code
Angius
Angiusā€¢4mo ago
You need a project. Easiest way to create a simple CLI project is dotnet new console Then, running that code, is as simple as dotnet run
leowest
leowestā€¢4mo ago
u can do it from the search bar too its not too difficult
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
How do I do it from the search bar šŸ˜­
leowest
leowestā€¢4mo ago
there is a gif in the link above that shows how assuming u properly installed the devkit and everything like in the link above ofc
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Okay, sorry, I lost the web page, I had the wrong one open, I'm so stressed right now sorry sorry I did .NET: New Project and nothing's happened?
leowest
leowestā€¢4mo ago
did u do everything it says in that page to install the dev kit etc
Angius
Angiusā€¢4mo ago
Let's start with asking whether you have the .NET SDK installed or not
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
I think so, yeah - I've just downloaded it yeah
leowest
leowestā€¢4mo ago
can you open powershell and type dotnet --info and post the result here
Angius
Angiusā€¢4mo ago
Or any shell, VS Code's console should work as well
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
In the terminal yeah?
leowest
leowestā€¢4mo ago
sure
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
No description
No description
Angius
Angiusā€¢4mo ago
Good
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Oh okay wait it's actually done something now, what template do I want to select?
No description
Angius
Angiusā€¢4mo ago
What do you want to make? Just a simple "hello world" app that works from the terminal? Console App Web project? One of the ASP templates A library? Class library And so on
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Just a simple
Console.WriteLine("Hello World!")
Console.ReadLine()
Console.WriteLine("Hello World!")
Console.ReadLine()
Angius
Angiusā€¢4mo ago
Console app, then
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Do I type my code in Program.cs or my own file (the censored green one)?
No description
Angius
Angiusā€¢4mo ago
Yes, Program.cs ConsoleApp1 is your project
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Okay, okay ':) Does there need to be a ; at the end of the WriteLine or?
Angius
Angiusā€¢4mo ago
Yes Every statement in C# has to be terminated with a semicolon
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
i don't understand, there's been a build failure??
Angius
Angiusā€¢4mo ago
What do the errors say, and what is your code?
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Console.ReadLine()
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
Console.ReadLine()
are the only lines of code The terminal process terminated with exit code: 1. Terminal will be reused by tasks, press any key to close it.
Angius
Angiusā€¢4mo ago
You're missing another semicolon When I said "every" I meant "every", not "every statement but the last" or "every statement but Console.ReadLine()"
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Another build failure Sorry, I've added it now though and it's still not working
Angius
Angiusā€¢4mo ago
Same error?
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
WAIT NEVER MIND It gavem e a pop up error but the terminal says "Hello World!" Thank you so much. I'm new to C# and I have to learn it but the guide I've been given is really, well, not good šŸ˜­
Angius
Angiusā€¢4mo ago
$helloworld
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Thank you so much! Now, they want me to type this:
Console.WriteLine("Hello World" & "this is my first program");
Console.ReadLine();
Console.WriteLine("Hello World" & "this is my first program");
Console.ReadLine();
but it's only giving me "Hello, World!" which is the grammar from when I last wrote it but not this time??
Angius
Angiusā€¢4mo ago
What's the & supposed to do, you reckon?
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Concatenate them? I assume and the document claims that
Angius
Angiusā€¢4mo ago
That is not how concatenation is done in C# & is bitwise AND Concatenation is just a + Are you sure that whatever document you're following is talking about C#?
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
I'm not, it hasn't told me at all what the language is and I thought it was .js at first then that server told me it was C#, I don't know anymore
Angius
Angiusā€¢4mo ago
Can you, idk, post some code samples from this document? Oh, I just got chills down my spine & is how you concatenate in VB Please don't be VB...
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
They've asked me to type
Console.WriteLine("Hello World")
Console.ReadLine()
Console.WriteLine("Hello World")
Console.ReadLine()
then type
Console.WriteLine(Hello World)
Console.ReadLine()
Console.WriteLine(Hello World)
Console.ReadLine()
and how that doesn't work You have to be kidding me, what's up with VB
Angius
Angiusā€¢4mo ago
It's dead Has been for years
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
how am i how am i supposed to code
Angius
Angiusā€¢4mo ago
Nobody uses it but companies that have legacy projects they didn't bother updating to C# since 1999 $vb
Angius
Angiusā€¢4mo ago
Some people might help there, if it really is VB
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
This is the third server I'm joining because of this work šŸ˜­ Thanks for your help
Angius
Angiusā€¢4mo ago
And sure enough, in VB semicolons are optional Yeah, that's VB My condolences Hope you enjoy necromancy and digging in corpses
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
LMAOOOO Thank you for your help šŸ˜­
That_Guy977
That_Guy977ā€¢4mo ago
oh god, that's horrible
Angius
Angiusā€¢4mo ago
Take this job to put some bread on the table and pad your CV some, but if they really are a VB shop and there's no sign of migrating to C#, start looking for a new one That'd be my advice
That_Guy977
That_Guy977ā€¢4mo ago
what kind of course are you in wtf
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
a stupid one They wanted me to do this as example work, so I could like prep myself but I don't even know if I wanna do this anymore šŸ˜­
That_Guy977
That_Guy977ā€¢4mo ago
your course has not been updated in decades
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
The VB server isn't saying anything I'm still waiting for a response to my help request but someone asked on the 25th August and got no response and since joining, not a single message has been sent to any channels
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Do any of you know how to work this 'cause I genuinely have no idea. The video they sent me isn't helping one bit
No description
Angius
Angiusā€¢4mo ago
The inside of the Main() method is where your code goes
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
Thank you! Oh my God. I feel lighter I've never had so much stress and weight taken away by the two words "Hello World" Thank you so much! 33 more pages to go now šŸ˜œ Just to give y'all an update, there are a hella lot of mistakes in this document šŸ˜­
That_Guy977
That_Guy977ā€¢4mo ago
vb was the first mistake
Jimjam#9770
Jimjam#9770OPā€¢4mo ago
LMAOOO
Angius
Angiusā€¢4mo ago
There's multiple flavours of VB, too There's VB, and there's VB.NET
Want results from more Discord servers?
Add your server