✅ 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?
44 Replies
you're missing a semicolon on first line of code.
using System;
one more thing
sure
if i'm correct, two of the lnes should really look like this
but in the file, they're blue
not yellow
Depends on the IDE's color scheme
try after putting the semicolon on first line as I said
VS by default has a very same-y color scheme, IME
i did
ah okay. By default the VS should color functions as yellow but not sure what's the case there
maybe restart the VS
both of these screenshots are the same editor some color scheme
okay
it didn't do anything
no idea then
is the code working fine now?
when it starts, its yellow
no
what's the issue
or error
did you create a project for this?
yeah, why?
I find it very odd for VSC to not display a red squiggly for the
using System
Did you open that project, or just the file?
What's the solution explorer look like?
not to mention the syntax coloring being wonky
@Scorpion have you installed the C# DevKit Extension
i have
like ZZZ mentioned, how did you open that file
when I made it? or right now?
when you opened the editor, how did you open the file
Open folder / Open file
which one
folder
@Scorpion can you share the screenshot of your VSC window
okay so the project isn't properly created
solution explorer?
Do you have a
.csproj
file?its .cs
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 .
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
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
Do you have a .NET SDK installed?
dotnet --info
i think so but im not sure how to check....
dotnet --info
k
No. I didn't think about that
$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
Follow these instructions
Why are you hiding the file name and namespace?
no clue tbh
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View