Bun — the fast all-in-one JavaScript runtime, bundler and package manager — for .NET, as a pinned NuGet dependency rather than something you install separately.
Bundle and minify JavaScript and TypeScript, compile Sass/SCSS, and install npm dependencies without Node.js, on Windows, Linux and macOS (x64 and ARM64).
They are independent — use either, or both.
dotnet add package Scarlet.Bun.MSBuild<ItemGroup>
<BunBeforeStaticWebAssets Include="run">
<Arguments>build.mjs</Arguments>
</BunBeforeStaticWebAssets>
</ItemGroup>The Bun binary comes either from a platform-specific Scarlet.Bun.Runtime.* package or from an on-demand
download, whichever suits your build.
📖 Full documentation → — installation, the three runtime options, task parameters, multi-targeting, and a worked JavaScript/SCSS build script.
dotnet new tool-manifest
dotnet tool install Scarlet.Bun.Cli
dotnet bun run build.mjsThe tool version is the Bun version, so .config/dotnet-tools.json pins Bun alongside the rest of your
tooling. Scarlet.Bun.Cli is a pointer package; installing it also pulls a matching Scarlet.Bun.Cli.*
sub-package for your platform, and that one embeds the Bun binary, so it needs no network at run time.
📖 Full documentation → — installing, how it finds Bun, and the environment variables.
| Package | Contains |
|---|---|
| Scarlet.Bun.MSBuild | The MSBuild task. Versioned independently. |
| Scarlet.Bun.Cli | The dotnet bun tool. Version = the embedded Bun version. |
| Scarlet.Bun.Runtime.windows-x64-baseline | Bun for Windows x64 |
| Scarlet.Bun.Runtime.windows-aarch64 | Bun for Windows ARM64 |
| Scarlet.Bun.Runtime.linux-x64-baseline | Bun for Linux x64 |
| Scarlet.Bun.Runtime.linux-aarch64 | Bun for Linux ARM64 |
| Scarlet.Bun.Runtime.linux-x64-musl-baseline | Bun for Linux x64, musl (Alpine) |
| Scarlet.Bun.Runtime.linux-aarch64-musl | Bun for Linux ARM64, musl (Alpine) |
| Scarlet.Bun.Runtime.darwin-x64-baseline | Bun for macOS x64 |
| Scarlet.Bun.Runtime.darwin-aarch64 | Bun for macOS ARM64 |
The Scarlet.Bun.Runtime.* packages are consumed by Scarlet.Bun.MSBuild and can also be installed
directly (see its README); the CLI embeds its own Bun and does not use them. Their package version is the
Bun version they contain.
Scarlet.Bun.Cli restores its own per-platform Scarlet.Bun.Cli.* sub-packages (one per RID, plus a
portable .any fallback) automatically — unlike the Runtime.* packages, these are a dotnet tool
implementation detail, never meant to be installed directly, so they aren't listed here.
Windows, Linux and macOS on x64 or arm64, including musl-based Linux distributions such as Alpine. Any
other architecture gets an explanatory error rather than a mismatched binary — point at your own Bun with
SCARLET_BUN_PATH (CLI) or BunRuntimeDirectory (MSBuild) if you need one of them.
dotnet buildUnit tests:
dotnet test tests/Scarlet.Bun.MSBuild.Tests/Scarlet.Bun.MSBuild.Tests.csprojIntegration tests:
dotnet test tests/Scarlet.Bun.MSBuild.IntegrationTests/Scarlet.Bun.MSBuild.IntegrationTests.csprojCLI tests:
dotnet test tests/Scarlet.Bun.Cli.Tests/Scarlet.Bun.Cli.Tests.csprojAll tests:
dotnet testEnd-to-end scenarios pack real packages into a local feed and consume them from a temporary project. They take a workspace path, a package version and a Bun version:
tests/e2e/package-installation/verify.sh "$PWD" 1.0.0-local 1.4.2
tests/e2e/cli-tool/verify.sh "$PWD" 1.0.0-local 1.4.2dotnet pack src/Scarlet.Bun.MSBuild/Scarlet.Bun.MSBuild.csprojThe CLI packs into ten packages at once — one per runtime identifier, a portable fallback and a top-level pointer package:
dotnet pack src/Scarlet.Bun.Cli/Scarlet.Bun.Cli.csprojsrc/Scarlet.Bun.Core is a shared library used by both shipping packages. It is deliberately not
published: the MSBuild package packs the assembly into its tools/ folder, and the CLI carries it in its
publish output.
- .NET / .NET Core (no .NET Framework support)
- Supported on Windows, Linux, and macOS
This project is licensed under the MIT License - see the LICENSE file for details.
This project distributes official Bun executables. Bun itself is MIT licensed; its statically linked JavaScriptCore/WebKit components and other bundled libraries retain their respective licenses. See LICENSE-3RD-PARTY.txt for the notices and source links distributed with the packages, and Bun's authoritative license document for its version-specific component list and relinking instructions.
- Built by ScarletKuro
- Uses Bun - a fast all-in-one JavaScript runtime
Contributions are welcome! See CONTRIBUTING.md for how to build, test, and submit a Pull Request.