Error on VS Code on M1 Mac
I have installed all C# extenstions that are needed, though I am still getting an error. Screenshot attached.
44 Replies
Is there a specific reason you're using scriptcs rather than creating a proper Project?
not sure what is scriptcs
it's what's in your screenshot 🙂
I know. Though I havent installed anything titled "scriptcs:
just all vscode extensions
for c#
What are "all" the extensions you installed? And how did you create the file/project you're working on? Did you follow these instructions:
https://learn.microsoft.com/en-us/dotnet/core/tutorials/with-visual-studio-code?pivots=dotnet-8-0
Create a .NET console application using Visual Studio Code - .NET
Learn how to create a .NET console application using Visual Studio Code and the .NET CLI.
C# is project based
Scriptcs is a 3rd party tool.
Please use
dotnet new console
new to coding so pardon me. Though, to my understanding. A project is created via making a project folder, and programs files into that folder correct?
Which will create a project with template console
C# requires a csproj
It is not like python where you can just execute the program with a single .cs file
It needs to be compiled into an executable.
ah right thats how i was running it
into terminal?
Yes.
That will create a new console project in current directory
from here. i would open this in vs code?
After that you open the folder where the csproj exists if you are using VSCode
seems like i cant?
In vscode open the Folder that file is in
that file isnt in any folder
i cant drag it neither
It literally is
The folder is "jacob"
oh lol
It was created in /Users/jacob
right right
So you open the jacob folder
okay so two questions. I dont like that its in the jacob folder. its filled with too much stuff. i just want the c# project. how would i change the directory. also. i opened the folder. now what?
this is that jacob.csproj opens up to
You would start writing your code in the Program.cs file
or create new .cs files as your program grows
ah i see. though im still getting this error upon running
if you want to run your app do:
dotnet run
in the vs code terminal?
yeah
Uninstall that extension too
scriptcs? what would be the terminal command to uninstall it. i dont see it in the vscode extension
s
are you just typing in the scriptcs command because you read it somewhere, and you don't actually have anything for it installed?
im not typing anything. im just running and thats what pops up
dotnet run doesnt seem to do anything
Should just print
yea thats odd
Are you in the correct directory with the terminal?
$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 this