Recently, Build 2025 took place, and although I’m not covering it in full because there are just a few things specifically about C#, it did leave us with some interesting nuggets. In this post, we’ll look at one in particular—how prototyping applications in C# has changed, as compiling is no longer necessary.
Table of Contents
NOTE: This feature is available in .NET 10 with C# 14, currently in preview.
1 - Launch of C# as a Scripting Language in .NET 10
Although it’s technically not officially announced this way, I think it’s clear that the goal is to make C# a language that works for everyone and for everything. In this new version, you can run C# code directly in the CLI without needing a project (.csproj); just a single .cs file is enough.
Let’s create a file named test.cs and write the following line:
Console.WriteLine("hello world");
As you can see, this is the classic hello world, but now, there’s no .csproj
.
Now, just run dotnet run test.cs
in your terminal, and it works perfectly:
What happens behind the scenes is that the dotnet run command creates an msbuild project in a cache folder, restores packages, compiles in the background, and runs the resulting binary.
2 - Using SDKs and Libraries
The idea behind these files is to have full support for C#, which means you can import any library you want with the #:package
instruction, or if you want to go further and use an SDK—such as the web SDK for minimal APIs—you can do that with the #:sdk
instruction. Here’s an example:
#:sdk Microsoft.NET.Sdk.Webvar app = WebApplication.Create(args);app.MapGet("/", () => "example minimal API");app.Run();
If you execute this with dotnet run test.cs
, it will start a minimal API just as if you created a fresh project from scratch.
3 - What is Microsoft aiming for with this change?
Personally, I’ve been saying for years that Microsoft is trying to attract talent from outside the .NET ecosystem into .NET itself. A few years ago, we got top-level statements, which got rid of lots of unnecessary code and indentation. Later, we saw minimal APIs, which reduced the code needed for small projects and made C# look more like other popular languages.
And finally, they've taken the step to try to make C# a scripting language. If they pull this off, I think in the long term, it could replace PowerShell—because many .NET developers who need to write a script use another language like Python since .NET wasn't convenient for scripting. Now, things are different.
Additionally, this change also makes it easier for less experienced people to adopt .NET and C# since the barrier to entry is much lower: just a file and a command to start practicing.
Personally, I like this change—a lot, actually—because I always have an empty test project for trying out ideas, and now I can just create a file and that's it.
That said, it still needs some polish. I’m not sure if it will definitely make it into .NET 10, but it’s essential to have perfect Intellisense support in Visual Studio Code for this feature to be truly successful.
If there is any problem you can add a comment bellow or contact me in the website's contact form