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 š
60 Replies
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
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
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
u can do it from the search bar too
its not too difficult
How do I do it from the search bar š
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
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?
did u do everything it says in that page to install the dev kit etc
Let's start with asking whether you have the .NET SDK installed or not
I think so, yeah -
I've just downloaded it yeah
can you open powershell and type dotnet --info
and post the result here
Or any shell, VS Code's console should work as well
In the terminal yeah?
sure
Good
Oh okay wait it's actually done something now, what template do I want to select?
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
Just a simple
Console app, then
Do I type my code in Program.cs or my own file (the censored green one)?
Yes, Program.cs
ConsoleApp1
is your projectOkay, okay ':)
Does there need to be a ; at the end of the WriteLine or?
Yes
Every statement in C# has to be terminated with a semicolon
i don't understand, there's been a build failure??
What do the errors say, and what is your code?
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.
You're missing another semicolon
When I said "every" I meant "every", not "every statement but the last" or "every statement but
Console.ReadLine()
"Another build failure
Sorry, I've added it now though and it's still not working
Same error?
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 š
$helloworld
Thank you so much!
Now, they want me to type this:
but it's only giving me "Hello, World!" which is the grammar from when I last wrote it but not this time??
What's the
&
supposed to do, you reckon?Concatenate them? I assume and the document claims that
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#?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
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...They've asked me to type
then type
and how that doesn't work
You have to be kidding me, what's up with VB
It's dead
Has been for years
how am i
how am i supposed to code
Nobody uses it but companies that have legacy projects they didn't bother updating to C# since 1999
$vb
Some people might help there, if it really is VB
This is the third server I'm joining because of this work š
Thanks for your help
And sure enough, in VB semicolons are optional
Yeah, that's VB
My condolences
Hope you enjoy necromancy and digging in corpses
LMAOOOO
Thank you for your help
š
oh god, that's horrible
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
what kind of course are you in wtf
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 š
your course has not been updated in decades
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
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
The inside of the
Main()
method is where your code goesThank 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 š
vb was the first mistake
LMAOOO
There's multiple flavours of VB, too
There's VB, and there's VB.NET