C
C#15mo ago
Aimlatte

❔ which one how how should I fix this problem?

-dotnet run keep running program.cs but not my code -try setting startup file by Right-click on the project but can't find "Set as Startup Project." -try Open Solution Explorer by cliking View > Solution Explorer but can't find Explorer -try using keyboard shortcut Ctrl+Alt+L but nothing shows up either -try seurching for another version by going to view > Other Windows > Solution Explorer but can't find other windows -try using keyboard shortcut Ctrl + W, S but nothing shows up either -try customize keyboard shortcuts by Go to Tools > Options but can't find tool -try Using the Keyboard Shortcut to open Press Ctrl + Alt + L to opening the Solution Explorer to open explorer solution but doesn't work sorry for asking question that can be answered in google but none of them works for me:(
22 Replies
artya
artya15mo ago
Could you show the code in Program.cs? $code
MODiX
MODiX15mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
Aimlatte
AimlatteOP15mo ago
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
// See https://aka.ms/new-console-template for more information
Console.WriteLine("Hello, World!");
artya
artya15mo ago
Does "Hello World!" show up after you dotnet run?
Aimlatte
AimlatteOP15mo ago
yes
artya
artya15mo ago
Ah, so you want to run code in a seperate file?
Aimlatte
AimlatteOP15mo ago
yes
Aimlatte
AimlatteOP15mo ago
this one is the code I want to run
artya
artya15mo ago
You can move the code inside of the Main method to the Main method inside of Program.cs I forgot about top-level statements, you can instead just copy the code inside of your exercise.cs "Main" method into Program.cs The dotnet run looks for the file named Program.cs in your project. It's the starting point of your program!
-try setting startup file by Right-click on the project but can't find "Set as Startup Project."
-try Open Solution Explorer by cliking View > Solution Explorer but can't find Explorer
-try using keyboard shortcut Ctrl+Alt+L but nothing shows up either
-try seurching for another version by going to view > Other Windows > Solution Explorer but can't find other windows
-try using keyboard shortcut Ctrl + W, S but nothing shows up either
-try customize keyboard shortcuts by Go to Tools > Options but can't find tool
-try Using the Keyboard Shortcut to open Press Ctrl + Alt + L to opening the Solution Explorer to open explorer solution but doesn't work
-try setting startup file by Right-click on the project but can't find "Set as Startup Project."
-try Open Solution Explorer by cliking View > Solution Explorer but can't find Explorer
-try using keyboard shortcut Ctrl+Alt+L but nothing shows up either
-try seurching for another version by going to view > Other Windows > Solution Explorer but can't find other windows
-try using keyboard shortcut Ctrl + W, S but nothing shows up either
-try customize keyboard shortcuts by Go to Tools > Options but can't find tool
-try Using the Keyboard Shortcut to open Press Ctrl + Alt + L to opening the Solution Explorer to open explorer solution but doesn't work
Are these all questions that need answering, or are they all related to Program.cs problem?
Aimlatte
AimlatteOP15mo ago
they are all related to Program.cs problem
artya
artya15mo ago
Ah ok, does your code run now?
Aimlatte
AimlatteOP15mo ago
not yet 😦
Aimlatte
AimlatteOP15mo ago
artya
artya15mo ago
In Program.cs remove line 2 through 6 and 14 trough 16 This should be the only code in Program.cs
using System;

Console.WriteLine("Enter input:");
string input = Console.ReadLine();
int loop = 1;
while (loop <= 10)
{
Console.WriteLine(inout + " loves me");
loop++
}
using System;

Console.WriteLine("Enter input:");
string input = Console.ReadLine();
int loop = 1;
while (loop <= 10)
{
Console.WriteLine(inout + " loves me");
loop++
}
Aimlatte
AimlatteOP15mo ago
public class don't needed?
artya
artya15mo ago
No All you need is this!
Aimlatte
AimlatteOP15mo ago
why does this class don't need public class and public static void main(String[] args) while other need?
ero
ero15mo ago
You had a link here which you removed that elaborates on the new console app template
Angius
Angius15mo ago
You cannot run individual files, just FYI Each project can have only a single Main() Whether it's explicitly written, or implicitly generated with top-level statements
Azrael
Azrael15mo ago
Uhh, what are you doing here?
Unknown User
Unknown User15mo ago
Message Not Public
Sign In & Join Server To View
Accord
Accord15mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server