NetPack.Build
0.8.1
dotnet add package NetPack.Build --version 0.8.1
NuGet\Install-Package NetPack.Build -Version 0.8.1
<PackageReference Include="NetPack.Build" Version="0.8.1"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
<PackageVersion Include="NetPack.Build" Version="0.8.1" />
<PackageReference Include="NetPack.Build"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add NetPack.Build --version 0.8.1
#r "nuget: NetPack.Build, 0.8.1"
#:package NetPack.Build@0.8.1
#addin nuget:?package=NetPack.Build&version=0.8.1
#tool nuget:?package=NetPack.Build&version=0.8.1
<p align="center"> <a href="https://netpack.anglevisions.com"><img src="https://raw.githubusercontent.com/FlorianRappl/netpack/main/art/icon.png" alt="netpack" width="120" height="120" /></a> </p>
NetPack.Build
Bundle your web assets as part of the .NET build.
Website · Documentation · Source · CLI on npm
This package wires netpack into MSBuild: on
dotnet build (or publish) it bundles and optimizes your JavaScript /
TypeScript / JSX / CSS / HTML entry point straight into wwwroot — ideal for
ASP.NET Core apps.
It's built on NetPack.Core and ships a cross-platform, pure-managed image
processor (ImageSharp) — no SkiaSharp, no native/OS dependency. Everything the
task needs is bundled, so it adds no package references to your project.
Install
dotnet add package NetPack.Build
Use
Point it at an entry file and build:
<PropertyGroup>
<NetpackEntry>ClientApp/src/index.html</NetpackEntry>
</PropertyGroup>
dotnet build
# -> wwwroot/index.html, wwwroot/index.js, wwwroot/styles.css, …
That's it — bundling runs after Build whenever NetpackEntry is set.
Options
All are MSBuild properties with sensible defaults:
| Property | Default | Purpose |
|---|---|---|
NetpackEntry |
— | entry file (enables the integration when set) |
NetpackOutputDirectory |
$(MSBuildProjectDirectory)/wwwroot |
output folder |
NetpackMinify |
true |
minify + tree-shake |
NetpackSourceMaps |
false |
emit source maps |
NetpackFormat |
esm |
esm / cjs / umd / systemjs |
NetpackPlatform |
web |
web / node / deno |
NetpackEntryNames |
[name] |
naming template, e.g. [name]-[hash] |
NetpackPublicPath |
— | base URL/path for emitted-file references |
Keep dependencies external with an item group:
<ItemGroup>
<NetpackExternal Include="react" />
<NetpackExternal Include="react-dom" />
</ItemGroup>
Notes
- No native dependency. Image resizing/re-encoding uses ImageSharp (Apache-2.0,
the 2.1.x line). Formats it doesn't cover (
.avif,.ico) are copied as-is. - Build with the .NET SDK. The task targets .NET 8, so build via
dotnet build/dotnet msbuild(the SDK's .NET-based MSBuild). - Node.js is only needed for the optional Sass/Less/PostCSS/Svelte features; plain JS/TS/JSX/CSS/HTML bundling needs nothing extra.
- Prefer the API directly? Use
NetPack.Core. Prefer a CLI?npm i -D netpack.
MIT licensed — https://github.com/FlorianRappl/netpack.
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.