Bundle and minify web assets in .NET projects without Node.js.
WebBundler is a lightweight, deterministic and CI-friendly asset bundler for .NET web applications.
It helps you bundle and minify CSS and JavaScript files without requiring Node.js, npm, Vite, Webpack, Rollup or any heavy frontend toolchain.
NuGet packages :
- https://www.nuget.org/packages/WebBundler.Minification
- https://www.nuget.org/packages/WebBundler.Tool
- https://www.nuget.org/packages/WebBundler.MSBuild
- https://www.nuget.org/packages/WebBundler.Configuration
- https://www.nuget.org/packages/WebBundler.Core
- https://www.nuget.org/packages/WebBundler.Fingerprinting
Many .NET web projects do not need a full JavaScript build stack.
Sometimes you only need to:
- combine a few CSS files
- bundle JavaScript files in a fixed order
- minify outputs during build
- generate fingerprinted assets
- produce a manifest file for cache-busting
- run the same behavior locally and in CI/CD
- keep the asset pipeline inside the .NET ecosystem
WebBundler is built for this use case.
Create a bundleconfig.json file at the root of your project:
{
"$schema": "https://raw.githubusercontent.com/korgys/WebBundler/main/schemas/bundleconfig.v1.schema.json",
"version": 1,
"manifestOutput": "wwwroot/dist/webbundler.manifest.json",
"bundles": [
{
"output": "wwwroot/dist/site.min.css",
"inputs": ["wwwroot/css/reset.css", "wwwroot/css/site.css"],
"type": "css",
"minify": true,
"fingerprint": true,
"sourceMap": true
},
{
"output": "wwwroot/dist/site.min.js",
"inputs": ["wwwroot/js/vendor/*.js", "wwwroot/js/app.js"],
"type": "js",
"minify": true,
"fingerprint": true,
"sourceMap": true
}
]
}Install the tool from NuGet:
dotnet tool install --global WebBundler.ToolRun it from the project root:
webbundler validate --config bundleconfig.json
webbundler check --config bundleconfig.json
webbundler build --config bundleconfig.json| Command | Purpose | Writes files |
|---|---|---|
webbundler validate |
Validates configuration structure only | No |
webbundler check |
Validates configuration and resolves asset inputs | No |
webbundler build |
Builds bundles, source maps, and any configured manifest | Yes |
Add the package to a web project:
<ItemGroup>
<PackageReference Include="WebBundler.MSBuild" Version="1.0.0" PrivateAssets="all" />
</ItemGroup>The build target looks for bundleconfig.json in the project directory by default and runs once per build or publish invocation.
Useful MSBuild properties:
WebBundlerConfigFile: path to the configuration file.WebBundlerEnabled: enables or disables WebBundler during build.WebBundlerEnableFingerprinting: globally enables fingerprinted outputs.WebBundlerWriteOutputs: controls whether output files are written.
Current capabilities include:
- CSS and JavaScript minification
- CSS and JavaScript bundling
- fingerprinted output files
- CLI usage, CI/CD support
- MSBuild integration
- JSON configuration via
bundleconfig.json - versioned JSON Schema for IDE completion
- manifest generation via
manifestOutput - external sibling
.mapsource maps for CSS and JavaScript
WebBundler follows a few key principles:
- CLI-first for automation and scripting
- MSBuild-first for .NET project integration
- Visual Studio friendly, but not IDE-dependent
- Deterministic behavior so local and CI outputs match
- Simple configuration and explicit behavior
- Maintainable architecture with clean separation of concerns
- Quickstart
- Migration guide
- Compatibility
- FAQ
- CLI reference
- Configuration
- Installation
- MSBuild
- Architecture
See the docs above for examples and implementation details.