✅ Setting up C# in VS code

Having a issue, setting it up or whatnot? I'm not sure what the problem is.
130 Replies
Buddy
Buddy7d ago
$vscode
MODiX
MODiX7d ago
Follow the instructions here on getting started with DevKit for C# in VSCode: https://code.visualstudio.com/docs/csharp/get-started
Getting Started with C# in VS Code
Getting Started with C# and .NET Development in Visual Studio Code
WhiteHatWizard (Edward)
Can you voice call?
Buddy
Buddy7d ago
No.
WhiteHatWizard (Edward)
Then dont comment
Buddy
Buddy7d ago
????
333fred
333fred7d ago
If you want help, ask questions that include relevant details?
WhiteHatWizard (Edward)
I'm doing a module. I've got a walk through, you could take two seconds out of your time besides giving someone unneeded resourses Im getting mad because it keeps crashing my computer
Buddy
Buddy7d ago
1. It is very rare to find someone willing to help by voice. 2. You can also take time writing more details -"it doesnt work, pls fix" is really nothing to go for.
WhiteHatWizard (Edward)
buddy, either take a moment to look or lemme show you or go on. Thanks
Buddy
Buddy7d ago
You made a thread in #help which is not for VC, it is help by text. You are free to upload images or videos.
WhiteHatWizard (Edward)
Im doing that certification
333fred
333fred7d ago
You might want to start by giving more detail. If you don't want to give more detail... maybe try a different forum that isn't about helping via text
WhiteHatWizard (Edward)
This is the help fourm
333fred
333fred7d ago
Yes And you have given us no details by which to help you We're not mind readers, and as you've noted, this is the help forum. Where we use text to communicate.
WhiteHatWizard (Edward)
I've commented what I've said, I can show you better then explaining
Buddy
Buddy7d ago
- Do you get any errors?
WhiteHatWizard (Edward)
It's either a human factor error Can I DM you @⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲ to show or explain
Buddy
Buddy7d ago
We do not accept DMs here.
333fred
333fred7d ago
Why can you not just provide us details here
Buddy
Buddy7d ago
Better getting help from +50K people than a single person, isn't it?
WhiteHatWizard (Edward)
All right onto the next user that will be more willing to help a individual So, I'm doing the module on FreeCodeCamp Correct? For installing or setting up on VS for the certification
WhiteHatWizard (Edward)
I was trying to run a basic program but, I'm familiar with Python so I'm not sure If I am running the program incorrect Maybe I compiled it wrong?
Buddy
Buddy7d ago
Any errors?? How do you call to compile and launch the program? Do you have C# dev kit extension installed in your VSCode?
WhiteHatWizard (Edward)
No I don't get the error's I was following the module and it told me to type dotnet Build into the terminal and when I do that it give's me a crash
Buddy
Buddy7d ago
Crash that says?
WhiteHatWizard (Edward)
What? Okay, this is the best way I know how to explain it without wasting my time at this point of night
Buddy
Buddy7d ago
You said it gives you a crash, does it say anything when it crashes?
WhiteHatWizard (Edward)
Closes the software/program down
tannergooding
tannergooding7d ago
people are trying to help, please be mindful of that and don't make statements about wasting your time the inverse could equally be stated
WhiteHatWizard (Edward)
I understand just frustration I appologize @⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲ My regards go out to you.
Buddy
Buddy7d ago
Do you have a code example of the C# code you are trying to build?
WhiteHatWizard (Edward)
Just compiling a simple one, like you would in .py I suppose Console.WriteLine("Hello World");
Buddy
Buddy7d ago
Ok.
WhiteHatWizard (Edward)
I'm working on the Foundational here, so please bare with me. It's getting late, I was trying to explain because I am tired
Buddy
Buddy7d ago
So, dotnet build does not actually start the program. It simply just compiles it. You can run it with either dotnet run or by vscode's launch button (which requires an extension or manual configuration)
WhiteHatWizard (Edward)
Are you allowed to run a simple command like that Ahhhhh lemme try that in the terminal One moment
Buddy
Buddy7d ago
This extension is what was linked at the beginning. And it guides you through setting up VSCode for C# including extensions that are up-to date with Microsoft standards.
WhiteHatWizard (Edward)
Yeah. I get this kind of error It's not a supported kind of file extention So, I was using the intergrated terminal on MS
333fred
333fred7d ago
Copy/paste the entire terminal output From your dotnet run
WhiteHatWizard (Edward)
Couldn't find a project to run. Ensure a project exists in C:\Users\Edwar\Desktop\General\Coding Project's\C# Experience, or pass the path to the project using --project.
333fred
333fred7d ago
So, I'm assuming you just created a .cs file
333fred
333fred7d ago
And didn't create a project
WhiteHatWizard (Edward)
I'm going by the module lol
333fred
333fred7d ago
dotnet run file.cs is a feature that is coming soon, but it does not exist yet. Well, the module tells you to create a project
WhiteHatWizard (Edward)
lemme go back over it. One moment
333fred
333fred7d ago
Yes. You did not do that last Exercise Exercise - Create, build, and run your application
WhiteHatWizard (Edward)
Fred could I screen share with you
333fred
333fred7d ago
You can screenshot I'm not joining voice
Buddy
Buddy7d ago
C# is project-based, which means you need to create a project instead of running individual files for now
WhiteHatWizard (Edward)
So basically, I need a actual more detailed project ran or operated
Buddy
Buddy7d ago
You can create a project from the dotnet new command which is mentioned in https://learn.microsoft.com/en-us/training/modules/install-configure-visual-studio-code/7-exercise-create-build-run-app at the top
WhiteHatWizard (Edward)
That's the one I was having a issue on
333fred
333fred7d ago
So what output do you get when you run the command that module tells you to run?
WhiteHatWizard (Edward)
I'm new to C#
333fred
333fred7d ago
Yes, I understand that. What output do you get when you run the command that module tells you to run?
WhiteHatWizard (Edward)
dotnet new console -o ./CsharpProjects/TestProject I entered this command into the terminal
Buddy
Buddy7d ago
What do you see after you entered that into the terminal? Any new text being written below it?
WhiteHatWizard (Edward)
yeah Im onto something
Buddy
Buddy7d ago
:PauseChamp:
ero
ero7d ago
You don't even need the terminal to create and run projects in vsc
WhiteHatWizard (Edward)
error CS8802: Only one compilation unit can have top-level statements.
333fred
333fred7d ago
This is probably from you creating a separate .cs file earlier You'll want to delete that one
WhiteHatWizard (Edward)
I done that still same error
333fred
333fred7d ago
A project collects all the files in the same folder or nested folder from your .csproj
WhiteHatWizard (Edward)
I'm not the kind to skip a module without actually getting a understand
333fred
333fred7d ago
Then you still have multiple files in the same folder or a nested folder from your csproj
hoggy077
hoggy0777d ago
I see all these links to resources & really just have to wonder how ya'll got here
333fred
333fred7d ago
Yes, you created a project in the current directory and in CSharpProjects This is messing things up
WhiteHatWizard (Edward)
Okay, lets start from scratch
hoggy077
hoggy0777d ago
good decision
ravindT~T
ravindT~T7d ago
before you do that, try deleting this 👇 and run dotnet run again?
No description
ravindT~T
ravindT~T7d ago
...that folder is what is referred to, here 👆
ero
ero7d ago
No description
No description
ero
ero7d ago
no need for the terminal at all
333fred
333fred7d ago
They're following the setup tutorial, probably best to just keep following it for now
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
333fred
333fred7d ago
No, that would not result in this output. Probably best to not make baseless speculation 🙂
WhiteHatWizard (Edward)
I'm tapping tonight sense I cannot get anyone on Voice, my brain is fried and it's late, I will close this discusion and open one tomorrow
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Okay, tomorrow better attitude Getting help is better then no progress Thanks everyone @⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲⇲ sorry again for my attitude
WhiteHatWizard (Edward)
How do I get rid of the CSharp on the left
ero
ero7d ago
right click it...?
333fred
333fred7d ago
C# Experience?
333fred
333fred7d ago
That's the folder you opened
WhiteHatWizard (Edward)
should I there Should I leave there or close
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
All right I am determined to figure this out
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Can someone walk me through where I am currently
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Hang on not to fast TacoBell
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
333fred
333fred7d ago
Alright tebeco, you know what you must do New nickname time
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
TebeCo so currently my screen is here
Accord
Accord7d ago
You will be reminded about it in 1 day
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Yeah basically, I was using the intergrated terminal also for C# on Microsoft Learning lets just stop here Normally when I use Python, I save it as a .py and run it and it'll run the program as long as a loop or something executiable is avalibale excuse my grammer but I want to ask even if I run the command
Console.WriteLine("Hello World!");
Console.WriteLine("Hello World!");
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Nothing is going to display correct? Send me that personally
ero
ero7d ago
?? just bookmark it
WhiteHatWizard (Edward)
I guess what I should ask, I need more then hello world to be able to run a actual line in C# Thanks btw
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
you know python right?
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
How you save it as .py
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Do I need to keep it saved as .CS or .csproj
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
No I followed a module and got lost and still am confused by it
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Makes sense I agree Is the program suppose to be executable with just the Console.WriteLine That's my question
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Okay tomorrow I'll @ you
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
We can start from there
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
ero
ero7d ago
yes
Unknown User
Unknown User7d ago
Message Not Public
Sign In & Join Server To View
WhiteHatWizard (Edward)
Okay Will do. Have a goodnight take care
Accord
Accord6d ago
@TeBeCo
Reminder
nickname

Did you find this page helpful?