✅ Rider Program does not contain Static Main
Program does not contain a static 'Main' method suitable for an entry point
Program.Helper.cs
My Program.cs
is empty43 Replies
Not sure what you're expecting us to say? If you don't have a
Main
method or a file with top-level statements, then there indeed isn't an entry pointnot a rider problem, i'm not even sure how you got here because no standard C# project template that looks like this
Your
Program
class is partial too, so I assume you're doing something weirdin vscode is does it automatically with top level statements?
No idea what you mean by that
I get it completely the error etc, just switching from vscode to rider this error is apparent unless i am doing something differently
this has nothing to do with your editor
the way your project looks when you create it depends on the template and options you selected
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
example old project
i feel like you're not listening to what we're saying
you did something to make your project not have a main/TLS
no template comes like that
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
regardless, just add a main or a file with top level statements and that will solve the problem
i did dotnet new console
and yeah true obj / bin should not be added mb
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
yep
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
dotnet new console will make a
Program.cs
with TLSUnknown User•6mo ago
Message Not Public
Sign In & Join Server To View
yeah it did
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
and then you deleted the code from Program.cs
oooh
so it doesn't know what to use as a main anymore
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
bro i get it
aah yeah okay
so if i put anything
like writeline
we all good
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
yes, or add an explicit main method $mains
The possible signatures for
Main
are public
is not required (can be any accessibility).
Top-level statements are compiled into a Main
method and will use an appropriate signature depending on the body.
https://docs.microsoft.com/en-US/dotnet/csharp/fundamentals/program-structure/main-command-lineMain() and command-line arguments - C#
Learn about Main() and command-line arguments. The 'Main' method is the entry point of an executable program.
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
yeah works
thanks, yeah i needed something in their to declare it as TLS
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
i do not use #region aha not yet anyways
this is the second time i've seen regions used so terribly
im going through the book series, on the second rn
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
i used regions in game dev unity a ton to seperate logic
but i guess that game dev
if this is what the book is teaching you to do, you might want to find a different book
regions in general aren't super useful, regions inside a single method is insane
its not a "this is the definite coding way" more just to learn some stuff with basic assistance
more of a topic coverage
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
yeah, i do not treat any content online as "best practices" ngl
Unknown User•6mo ago
Message Not Public
Sign In & Join Server To View
sick thanks guys, me being dumb ngl
The codebase is wild in general lmao
Target-type
new
next to format:
passed to Console.WriteLine