C
C#2mo ago
RobertGee

✅ Rider Program does not contain Static Main

Program does not contain a static 'Main' method suitable for an entry point Program.Helper.cs
using System.Globalization;

partial class Program
{
private static void ConfigureConsole(string culture = "en-US", bool useComputerCulture = false)
{
OutputEncoding = System.Text.Encoding.UTF8;

if(!useComputerCulture) CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(culture);

WriteLine($"Current Culture: {CultureInfo.CurrentCulture.DisplayName}");
}

private static void WriteLineInColor(string value, ConsoleColor color = ConsoleColor.White)
{
ConsoleColor previousColor = ForegroundColor;
ForegroundColor = color;
WriteLine(value);
ForegroundColor = previousColor;
}
}
using System.Globalization;

partial class Program
{
private static void ConfigureConsole(string culture = "en-US", bool useComputerCulture = false)
{
OutputEncoding = System.Text.Encoding.UTF8;

if(!useComputerCulture) CultureInfo.CurrentCulture = CultureInfo.GetCultureInfo(culture);

WriteLine($"Current Culture: {CultureInfo.CurrentCulture.DisplayName}");
}

private static void WriteLineInColor(string value, ConsoleColor color = ConsoleColor.White)
{
ConsoleColor previousColor = ForegroundColor;
ForegroundColor = color;
WriteLine(value);
ForegroundColor = previousColor;
}
}
My Program.cs is empty
43 Replies
333fred
333fred2mo ago
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 point
Jimmacle
Jimmacle2mo ago
not a rider problem, i'm not even sure how you got here because no standard C# project template that looks like this
Angius
Angius2mo ago
Your Program class is partial too, so I assume you're doing something weird
RobertGee
RobertGee2mo ago
in vscode is does it automatically with top level statements?
333fred
333fred2mo ago
No idea what you mean by that
RobertGee
RobertGee2mo ago
I get it completely the error etc, just switching from vscode to rider this error is apparent unless i am doing something differently
Jimmacle
Jimmacle2mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
RobertGee
RobertGee2mo ago
example old project
No description
No description
No description
Jimmacle
Jimmacle2mo ago
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
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
Jimmacle
Jimmacle2mo ago
regardless, just add a main or a file with top level statements and that will solve the problem
RobertGee
RobertGee2mo ago
i did dotnet new console and yeah true obj / bin should not be added mb
Unknown User
Unknown User2mo ago
Message Not Public
Sign In & Join Server To View
RobertGee
RobertGee2mo ago
yep
Want results from more Discord servers?
Add your server