Run a C# file directly using dotnet run app.cs

devblogs.microsoft.com

382 points by soheilpro 10 months ago


jbverschoor - 10 months ago

Great, but unfortunately, even when compiled, the startup overhead is about half a second, which makes it unsuitable for many applications. Still I applaud it, as Shell scripting is finicky, people thend to rely on bash features, and perl is kind of over. Ruby was, and still is, my go-to language for this purpose, but I've recently migrated some scripts over to Swift.

Swift does a much better job at this as interprets by default, and a compiled version starts instantaneously. I made a transparent caching layer for your Swift cli apps.Result: instant native tools in one of the best languages out there.

Swift Script Caching Compiler (https://github.com/jrz/tools)

dotnet run doesn't need it, as it already caches the compiled version (you can disable with --no-build or inspect the binaries with --artifacts-path)

pjmlp - 10 months ago

I find it a pity the lack of acknowledgement of the CSX/VBX effort.

https://ttu.github.io/dotnet-script/

Or that they on the wisdom of the C# Language Runtime, decided on an incompatible approach to how F# references dependencies on its scripts.

https://learn.microsoft.com/en-us/dotnet/fsharp/tools/fsharp...