I replaced 20 Python scripts with C# this year.
Here is the workflow.
For years, every time I needed a 20-line script, I created a solution, added a csproj, and waited for scaffolding to finish.
That's why I switched to writing them with Python.
.NET 10 changed that
and .NET 11 Preview 3 finished the job.
Now I run a single C# file directly:
𝚍𝚘𝚝𝚗𝚎𝚝 𝚛𝚞𝚗 𝚑𝚎𝚕𝚕𝚘.𝚌𝚜
No solution.
No project.
Just code.
𝗧𝗵𝗲 𝟰 𝗱𝗶𝗿𝗲𝗰𝘁𝗶𝘃𝗲𝘀 𝘁𝗵𝗮𝘁 𝗰𝗵𝗮𝗻𝗴𝗲 𝗲𝘃𝗲𝗿𝘆𝘁𝗵𝗶𝗻𝗴
These turn a single file into a real .NET application:
𝟭. #:𝗽𝗮𝗰𝗸𝗮𝗴𝗲
↳ Reference any NuGet package with one line
↳ #:package Newtonsoft.Json@13.0.3
𝟮. #:𝘀𝗱𝗸
↳ Switch SDKs to unlock ASP .NET Core
↳ #:sdk Microsoft[.]NET[.]Sdk[.]Web
𝟯. #:𝗽𝗿𝗼𝗷𝗲𝗰𝘁
↳ Reference an existing class library
↳ #:project ../MyLibrary/MyLibrary.csproj
𝟰. #:𝗶𝗻𝗰𝗹𝘂𝗱𝗲 (new in .NET 11 Preview 3)
↳ Split your code across multiple files
↳ #:include models.cs
That last one is the breakthrough.
In .NET 10, file-based apps were stuck in one file.
Now you structure a real app: models in one file, services in another, entry point in main.cs.
𝟱 𝗣𝘆𝘁𝗵𝗼𝗻 𝘀𝗰𝗿𝗶𝗽𝘁𝘀 𝗜 𝗿𝗲𝗽𝗹𝗮𝗰𝗲𝗱 𝗳𝗶𝗿𝘀𝘁
→ JSON and CSV transformations
→ Internal API smoke tests after deployment
→ Log file parsing to extract error patterns
→ Database seeding for local dev
→ HTTP health checkers for staging environments
The win is huge.
I get strong typing, IntelliSense, and async/await out of the box. I share code with my main .NET projects without rewriting a single line.
And when a script grows up, one command converts it:
𝚍𝚘𝚝𝚗𝚎𝚝 𝚙𝚛𝚘𝚓𝚎𝚌𝚝 𝚌𝚘𝚗𝚟𝚎𝚛𝚝 𝚖𝚊𝚒𝚗.𝚌𝚜
Tomorrow, I'm sending my complete file-based apps guide to 25,000 .NET developers:
✅ All 4 directives with real, runnable examples
✅ Building an HTTP health-check tool across 2 files
✅ A working Minimal API with EF Core and SQLite in just 3 files
✅ The exact rules for when to convert to a full project
This is the workflow that finally made C# competitive with Python and JavaScript for scripting.
📌 Subscribe to my weekly .NET newsletter, so you don't miss the issue:
↳
antondevtips.com/?utm_source…
What language do you write scripts in?
——
♻️ Repost to help other .NET developers build apps with 1 C# file
➕ Follow me (
@AntonMartyniuk ) to improve your .NET and Architecture Skills