C
C#3w ago
Scorpion

✅ Syntax Error

I'm very new to this so I tried to code something pretty basic in C# using Microsoft Visual Code. But the text isn't changing how it's supposed to and the code doesn't work. Can someone help me figure out what I'm somehow doing wrong?
No description
44 Replies
Salman
Salman3w ago
you're missing a semicolon on first line of code. using System;
Scorpion
Scorpion3w ago
one more thing
Salman
Salman3w ago
sure
Scorpion
Scorpion3w ago
if i'm correct, two of the lnes should really look like this
Scorpion
Scorpion3w ago
No description
Scorpion
Scorpion3w ago
but in the file, they're blue not yellow
Angius
Angius3w ago
Depends on the IDE's color scheme
Salman
Salman3w ago
try after putting the semicolon on first line as I said
Angius
Angius3w ago
VS by default has a very same-y color scheme, IME
Scorpion
Scorpion3w ago
i did
Salman
Salman3w ago
ah okay. By default the VS should color functions as yellow but not sure what's the case there maybe restart the VS
Scorpion
Scorpion3w ago
both of these screenshots are the same editor some color scheme okay it didn't do anything
Salman
Salman3w ago
no idea then is the code working fine now?
Scorpion
Scorpion3w ago
when it starts, its yellow no
Salman
Salman3w ago
what's the issue or error
SG97
SG973w ago
did you create a project for this?
Scorpion
Scorpion3w ago
yeah, why?
SG97
SG973w ago
I find it very odd for VSC to not display a red squiggly for the using System
Angius
Angius3w ago
Did you open that project, or just the file? What's the solution explorer look like?
SG97
SG973w ago
not to mention the syntax coloring being wonky
Salman
Salman3w ago
@Scorpion have you installed the C# DevKit Extension
Scorpion
Scorpion3w ago
i have
SG97
SG973w ago
like ZZZ mentioned, how did you open that file
Scorpion
Scorpion3w ago
when I made it? or right now?
SG97
SG973w ago
when you opened the editor, how did you open the file Open folder / Open file which one
Scorpion
Scorpion3w ago
folder
Salman
Salman3w ago
@Scorpion can you share the screenshot of your VSC window
Scorpion
Scorpion3w ago
No description
Salman
Salman3w ago
okay so the project isn't properly created
SG97
SG973w ago
solution explorer?
Angius
Angius3w ago
Do you have a .csproj file?
Scorpion
Scorpion3w ago
its .cs
Angius
Angius3w ago
So you did not, in fact, create a project Close VS Code Open the terminal where you want the project to be mkdir MyCoolProject && cd MyCooProject dotnet new console code .
Scorpion
Scorpion3w ago
PS C:\Users-----------------> dotnet new console
The command could not be loaded, possibly because: * You intended to execute a .NET application: The application 'new' does not exist. * You intended to execute a .NET SDK command: No .NET SDKs were found. Download a .NET SDK: ://aka.ms/dotnet-download Learn about SDK resolution: ://aka.ms/dotnet/sdk-not-found
Angius
Angius3w ago
Do you have a .NET SDK installed? dotnet --info
Scorpion
Scorpion3w ago
i think so but im not sure how to check....
Angius
Angius3w ago
dotnet --info
Scorpion
Scorpion3w ago
k No. I didn't think about that
Salman
Salman3w ago
$vscode
MODiX
MODiX3w 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
Salman
Salman3w ago
Follow these instructions
Buddy
Buddy3w ago
Why are you hiding the file name and namespace?
Scorpion
Scorpion3w ago
no clue tbh
Unknown User
Unknown User3w ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server
More Posts