80 Replies
You just... do?
MyCoolNewFile.cs
i just did 1
but why is there a error
Well, what does it say?
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
so for every code file i need to make a new project?
What does the error say
For every program you need a new project
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
You can have many files within one project, yes
how then
But those files must be a part of the same program
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
And only the entry file can have top-level code
All other files must be classes
(or structs or records or enums)
oh
well thats a bit sad
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
ok thanks
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
okok
thanks
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
but then how do i launch a specific code?
when i launch it launches the main 1
or do i have to invoke it in the main one?
You launch the project
That executes your entry file
There can only ever be a single entry point in a project
So... you don't
well b r u h
my brain is dying
If you want to create a new program, create a new project
You can use some tricks, of course
like i wanted to make a folder
inside it all the codes i have made within a course
For example something like
each "codes" probably equates to the need for an individual project for each, if they are all simple console applications. from what I am gathering.
Yeah, most likely
yea
You can group multiple projects into a single solution if you want
how
o
dotnet new sln -n MyCoolSolution
dotnet sln MyCoolSolution.sln add MyCoolProject/MyCoolProject.csproj
First command creates a solution file
Second adds a project to the solution
The structure would be like so
o
okokokok
thanks
To add onto that, when you try to run it you just need to specify which project you are trying to run, as there are obviously multiple.
with this right?
No
This is a workaround if you wanted to keep just a single project
With mutliple projects you... run the given project
cd ProjectOne && dotnet run
is the easiest IMHOagreed ^
But you can
dotnet run --project ProjectOne/ProjectOne.csproj
From the solution levelAlternatively if you have Visual Studio Community Edition or something of the likes you can easily select the startup project from a GUI.
I don't typically use vscode otuside of front end stuff, but there's probably a way there as well
man thats alot of stuff
but now i get the idea
thanks :D
No need to have Program2.cs and Program.cs. If you create two different csproj you can have Program.cs that is associated to each project like @ZZZZZZZZZZZZZZZZZZZZZZZZZ displayed
This is a pretty standard approach and should be followed
That way you don't end up with Program49.cs at some point, lol
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
so like u dont have to create an extra file to put the same code ?
but copy and paste it into another
:Ok:
I'm not sure I follow the question
like u dont manually make a new file
but the vsc does it for u
man i suck at explaining stuff
If you create a project within the sln, it should provide you with a Program.cs file tied to that project you created.
There's two different approaches you can take.
1) One sln, multiple projects (each with their own Program.cs file).
2) One sln, one project, multiple classes, and your Program.Cs controls which one you wish to run.
hm ok
i think all of those methods come to me in the future right xD
bc it will be hard to remember all of them
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
yea
but i think i understood enough to use them
thanks for the help sorry im stupid lol
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
So really at this point you just need to decide which approach you want to take, and if you have questions we can help with the decided upon approach. But we need to know which one you are wishing to proceed with
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
the most useful to be honest to follow a course is the point 2
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
to not get stuck in tutorial hell?
If you wish to start with approach 2 that will work, so you have a sln created with a single project already?
:kekw:
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
if u mean like this yes
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
yea im tryna add new stuff to experiment or add what i have learnt from the course
like make a shape and stuff
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
So with this, you only need one Program.cs then you can create a new class that will be resposnbile for each lesson.
So you may have:
Program.cs
Lesson1.cs
Lesson2.cs
Lesson3.cs
etc...
Or name them however you see fit
It may make sense to put like lessons into folders as well, if you'd like
wdym?
like every cs file into a folder?
Just providing options, but maybe something like this...
Or however your course is structured.
Bro Code
YouTube
C# Full Course for free 🎮
C# tutorial beginners full course (C# for Unity)
#C# #tutorial #Unity
⭐️Time Stamps⭐️
#1 (00:00:00) C# tutorial for beginners
#2 (00:06:30) output 💬
#3 (00:10:48) variables ✖️
#4 (00:19:32) constants π
#5 (00:20:35) type casting 💱
#6 (00:27:49) user input ⌨️
#7 (00:31:24) arithmetic operators 🧮
#8 (00:35:54) Math class 📏
#9 (0...
hes teaching
and using a different version
Really how you organize it is up to you, I can't decide that for you, but just providing the option that you can create a folder to hold like items together. Ultimately each lesson is it's own .cs file and can be organized as you see fit
okii
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
after the one im currently watching sure
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
bro code is good tho
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
wdym
whats .net
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View