Is there a way we can run individual .cs files in Visual Studio Code.
I have followed this link and runs fine but then I added Program2.cs and try to run using "dotnet run Program2.cs" but it failed for obvious reasons saying
Program2.cs(7,21): error CS0111: Type 'Program' already defines a member called 'Main' with the same parameter types [csharp.csproj]"
Is there a way to run individual .cs files. Or any way I can run individual .cs files that outputs to terminal/command prompt or console.
.csproj
file as well as the C# file. – MultifoldMain
function). What you can do is: Have multiple projects in one solution (with individual entrypoints, each. That will be multiple Programs, though) or have one main and control via cmd-line params what code to execute. One .cs file is not one program, it isn't even necessarily one class. It can contain multiple classes / types or one class can span multiple .cs files ... – Sigman