This feature is probably a big thing for .NET developer productivity. It's quite a shame, that it only came now.

There is another thing I'm really missing for .NET projects. The possibility to easily define project-specific commands. Something like "npm run <command>"

Nah, we've been doing this for years. At least ten years ago I built myself a little console based on Roslyn that would evaluate any C# snippets I gave it. C# scripts were pretty well supported, and it was not hard to throw one together. The engine of my console was a couple dozen lines mostly just processing the string.

I'm sure the tooling is better now, though. I seem to recall visual studio and/or Rider also supporting something like this natively at the time.

> This feature is probably a big thing for .NET developer productivity. It's quite a shame, that it only came now.

I am using https://github.com/dotnet-script/dotnet-script without any issues. Skipping an extra step would be cool though.

Is it possible to add those scripts project-scoped like with npm run? They should work for everyone who checks out the repo.

I think everyone needs to do `dotnet tool install -g dotnet-script` before running them. This is the most annoying part where .NET 10 announcement would be really appreciated.

But then each script has an individual list of dependencies so there should be no need for further scoping like in npm (as in, the compilation of the script is always scoped behind the scenes). In this regard, both should be similar to https://docs.astral.sh/uv/guides/scripts/#declaring-script-d... which I absolutely love.

You can use project-scoped tool manifests. Then you can call dotnet tool restore to load all tools specified in the manifest.

https://learn.microsoft.com/en-us/dotnet/core/tools/global-t...

Sure, but I think you still need to provide the full path of the script. If you're inside a source folder very deep it will lead to something like:

  dotnet script ../../../../../scrips/scaffold-something.cs
With npm run it works from any subdirectory:

  npm run scaffold-something

TIL, thank you!

This would be great! I'm currently using make files to accomplish this: https://www.gnu.org/software/make/

How can you use make as a script runner? Is it possible to add targets that are not part of the tree and execute every time you run them?

something like

  make clear-test-database
that runs every time you execute it, but is not executed on make all or make clean?

I remember using LINQPad when I needed this functionality filled.

you’re better off using a separate task runner like make or task.

I don't think make and task are suited very well for running scripts that are not part of the build process. Something like scaffolding, or starting a dev dependency. Also it requires the developers to install additional tools to get started with the project.