-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
β Not TriagedNot triagedNot triaged
Description
Describe the issue or suggestion
Proposal: Simplified Single File C# Execution
Current Situation
In many programming languages like JavaScript, Python, Java, C, C++, and Go, developers can easily run single source files without creating a full project structure. However, in .NET, running a single .cs file requires setting up an entire project with multiple files and configurations.
The Pain Points
- Increased friction for quick experiments
- Overhead for learning and prototyping
- Barrier to entry for newcomers
- Time-consuming setup for simple code snippets
Potential Solutions
1. Global Tool for Single File Execution
- Develop a dotnet global tool that can directly run a .cs file
- Example desired syntax:
dotnet run-cs MyScript.cs
2. Language-Level Support
- Introduce a compiler flag or runtime option to execute single files
- Similar to Python's or JavaScript's direct file execution
3. REPL Improvements
- Enhance C# Interactive (csi) to more seamlessly handle standalone files
- Make it more intuitive and feature-rich
Existing Partial Workarounds
- Using
dotnet script
(community package) - Mono's C# compiler
- Online REPLs
Questions for Discussion
- What are the technical challenges preventing single file execution?
- Are there architectural reasons for the current project-based approach?
- Would a standardized solution benefit the .NET ecosystem?
Community Impact
- Lower entry barrier for new developers
- Faster prototyping and learning
- Improved developer experience
// Current Painful Path
// Requires creating multiple files, project structure, etc.
/ Desired Simple Execution
// Imagine being able to just run: dotnet run-cs SimpleProgram.cs
//filename SimpleProgram.cs
public class SimpleProgram
{
public static void Main()
{
Console.WriteLine("Hello, World!");
}
}
ShadowXTz
Metadata
Metadata
Assignees
Labels
β Not TriagedNot triagedNot triaged