News for hackers. Stuff that matters.
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by recursive on Wednesday July 30, 2025 @01:54PM (#44737393)
I've wanted this for a long time. After reading this link, and the MS release announcement, I still don't understand what a "tool" is, or how you can use `tool exec` to run a single *.cs file. Is there a straight-forward recipe anywhere for doing this targeted at absolute simpletons?
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by banashark on Wednesday July 30, 2025 @04:37PM (#44739206)
Well if you're familiar with the node ecosystem it's a corollary for npx/bunx/etc.

It is so that folks can build and run "tools" that are executed, utilizing the nuget ecosystem.

Relevant links in the dotnet docs (was just a quick google away):

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

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

It's actually a top-level doc section in the primary dotnet docs (https://learn.microsoft.com/en-us/dotnet/).

To boil it down: you create a console app, add a couple of attributes to the solution file (https://learn.microsoft.com/en-us/dotnet/core/tools/global-t...). Packaging and publishing to nuget (if you want to share with others) is via `dotnet pack` and `dotnet nuget push` with some flags.

I do have to say it's actually very well documented.

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by recursive on Wednesday July 30, 2025 @06:00PM (#44740011)
Sorry for being unclear. Using tools isn't my goal. I want to run a single *.cs file from the console. It may be possible to achieve this using tools, but I don't know how. I did read the resources I could find, and didn't find any information about this.
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by banashark on Wednesday July 30, 2025 @07:15PM (#44740659)
Ah rereading your original comment that makes sense.

I found the announcement page here: https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-...

And here are the docs for “dotnet run” https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-r...

You’re right that it’s missing this new functionality. The blog post has some details to get started, but I’m guessing that a docs link or section is missing for that.

Dotnet covers quite a bit so the docs are accordingly larger than other projects that have a smaller scope. I will say though that while hit or miss, on average I’ve enjoyed their docs more than the average project.

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by easton on Wednesday July 30, 2025 @07:12PM (#44740639)
The docs are terrible right now (prerelease and all that), but to get started:

1. Install the dotnet sdk preview

2. Make a .CS file with top level statements.

3. dotnet run <file>

https://devblogs.microsoft.com/dotnet/announcing-dotnet-run-...

Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by jug on Wednesday July 30, 2025 @07:40PM (#44740834)
Sorry for confusing you. I can't edit the post now. The command is dotnet run script.cs. The tool stuff is about something else unrelated; NuGet installable CLI executables.
Re:.NET 10 Preview 6 brings JIT improvements, one-shot tool ... by SideburnsOfDoom on Thursday July 31, 2025 @07:46AM (#44744652)
> I still don't understand what a "tool" is

A dotnet tool is this: "A .NET tool is a special NuGet package that contains a console application. You can install a tool..."

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

it's actually very similar to the node.js / NPM equivalent, which came first:

https://docs.npmjs.com/downloading-and-installing-packages-g...