MintPlayer.AspNetCore.NodeServices
10.3.0
dotnet add package MintPlayer.AspNetCore.NodeServices --version 10.3.0
NuGet\Install-Package MintPlayer.AspNetCore.NodeServices -Version 10.3.0
<PackageReference Include="MintPlayer.AspNetCore.NodeServices" Version="10.3.0" />
<PackageVersion Include="MintPlayer.AspNetCore.NodeServices" Version="10.3.0" />
<PackageReference Include="MintPlayer.AspNetCore.NodeServices" />
paket add MintPlayer.AspNetCore.NodeServices --version 10.3.0
#r "nuget: MintPlayer.AspNetCore.NodeServices, 10.3.0"
#:package MintPlayer.AspNetCore.NodeServices@10.3.0
#addin nuget:?package=MintPlayer.AspNetCore.NodeServices&version=10.3.0
#tool nuget:?package=MintPlayer.AspNetCore.NodeServices&version=10.3.0
MintPlayer.AspNetCore.NodeServices
This package provides Node.js integration for ASP.NET Core applications, enabling server-side execution of JavaScript code. It is a core dependency for SPA prerendering functionality.
Installation
NuGet Package Manager
Install-Package MintPlayer.AspNetCore.NodeServices
.NET CLI
dotnet add package MintPlayer.AspNetCore.NodeServices
MSBuild Integration
This package automatically configures your project with MSBuild props and targets for SPA development. These are applied transitively to all projects that reference this package.
Properties
The following MSBuild properties are automatically configured (can be overridden in your .csproj):
| Property | Default | Description |
|---|---|---|
EnableSpaBuilder |
true |
Master switch to enable/disable all SPA build automation |
SpaRoot |
ClientApp\ |
Path to your SPA source folder |
BuildServerSideRenderer |
true |
Whether to build the SSR bundle during publish |
EnableSpaBuildCaching |
true |
Enable/disable SPA build caching based on folder hash |
SpaHashFilePath |
$(IntermediateOutputPath)spa-folder.hash |
Location to store the hash file |
ForceSpaBuild |
false |
Force rebuild even if hash unchanged |
CreateDefaultHasherIgnore |
true |
Auto-create .hasherignore with default patterns if missing |
Build Targets
| Target | Runs | Description |
|---|---|---|
EnsureHasherIgnoreFile |
Before ComputeSpaFolderHash | Creates default .hasherignore if missing |
ComputeSpaFolderHash |
Before DebugEnsureNodeEnv, PublishRunWebpack | Computes folder hash and determines if rebuild is needed |
DebugEnsureNodeEnv |
Before Build (Debug only) | Ensures Node.js is installed and runs npm install if node_modules doesn't exist |
PublishRunWebpack |
After ComputeFilesToPublish | Builds the SPA (if needed) and includes output in publish folder |
File Exclusions
The package automatically configures your project to:
- Exclude SPA source files from compilation
- Exclude
node_modulesfrom the project - Show SPA files in Solution Explorer without including them in build output
Disabling SPA Builder
If your project references this package (directly or transitively) but doesn't have a SPA, you can disable all build automation:
<PropertyGroup>
<EnableSpaBuilder>false</EnableSpaBuilder>
</PropertyGroup>
This will:
- Skip the
DebugEnsureNodeEnvtarget - Skip the
PublishRunWebpacktarget - Skip SPA file exclusion rules
Customizing SPA Root
If your SPA is in a different folder than ClientApp, override the SpaRoot property:
<PropertyGroup>
<SpaRoot>src\frontend\</SpaRoot>
</PropertyGroup>
Client-Only Builds
To build only the client bundle (without SSR) during publish:
<PropertyGroup>
<BuildServerSideRenderer>false</BuildServerSideRenderer>
</PropertyGroup>
SPA Build Caching
By default, this package caches SPA builds to avoid unnecessary rebuilds. It computes a hash of your SPA folder contents and only runs npm run build when the hash changes.
How It Works
- Before each publish, the package computes a SHA-256 hash of your
ClientAppfolder - The hash is compared against the previously stored hash (in
obj/spa-folder.hash) - If the hash is unchanged and
dist/exists, the build is skipped - If the hash changed or it's the first build,
npm run buildis executed
Build Command Selection
The build command is selected based on the BuildServerSideRenderer property:
| BuildServerSideRenderer | Build Command |
|---|---|
true (default) |
npm run build:ssr:production |
false |
npm run build -- --configuration production |
Default Ignore Patterns
By default, a .hasherignore file is automatically created in your ClientApp folder (if it doesn't exist) with these patterns:
| Category | Patterns |
|---|---|
| Dependencies | node_modules/ |
| Build outputs | dist/, dist-server/, build/, out/ |
| Framework caches | .angular/, .cache/, .npm/ |
| Test outputs | coverage/, test-results/, .nyc_output/ |
| IDE files | .idea/, .vscode/ |
| Editor temp files | *.swp, *.swo, *~ |
| OS files | .DS_Store, Thumbs.db |
This ensures that large folders like node_modules and transient files don't slow down hash computation or cause unnecessary rebuilds.
Customizing .hasherignore
You can customize the .hasherignore file to add or remove patterns. The syntax is similar to .gitignore:
# Build outputs (don't trigger rebuild when these change)
dist/
dist-server/
.angular/
# Dependencies
node_modules/
# IDE files
.idea/
.vscode/
# Test artifacts
coverage/
To prevent automatic creation of .hasherignore:
<PropertyGroup>
<CreateDefaultHasherIgnore>false</CreateDefaultHasherIgnore>
</PropertyGroup>
To customize the default patterns (before the file is created):
<ItemGroup>
<SpaHashDefaultIgnorePattern Include="my-custom-folder/" />
</ItemGroup>
Disabling Build Caching
To disable build caching and always rebuild:
<PropertyGroup>
<EnableSpaBuildCaching>false</EnableSpaBuildCaching>
</PropertyGroup>
Forcing a Rebuild
To force a rebuild even when the hash hasn't changed:
<PropertyGroup>
<ForceSpaBuild>true</ForceSpaBuild>
</PropertyGroup>
Or use the command line:
dotnet publish -p:ForceSpaBuild=true
Related Packages
- MintPlayer.AspNetCore.SpaServices - Core SPA services
- MintPlayer.AspNetCore.SpaServices.Prerendering - Prerendering support
- MintPlayer.AspNetCore.SpaServices.Routing - SPA route integration
License
This project is licensed under the Apache 2.0 License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- MintPlayer.SourceGenerators.Attributes (>= 10.13.0)
- Newtonsoft.Json (>= 13.0.4)
- Yarn.MSBuild (>= 1.22.19)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on MintPlayer.AspNetCore.NodeServices:
| Package | Downloads |
|---|---|
|
MintPlayer.AspNetCore.SpaServices
This package contains the ASP.NET Core prerenderer. |
|
|
MintPlayer.AspNetCore.SpaServices.Prerendering
This package is built as a dependency of MintPlayer.AspNetCore.SpaServices.Routing. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.3.0 | 99 | 2/1/2026 |
| 10.2.1 | 127 | 1/19/2026 |
| 10.2.0 | 112 | 1/18/2026 |
| 10.1.0 | 131 | 1/16/2026 |
| 10.0.1 | 120 | 1/12/2026 |
| 10.0.0 | 736 | 11/13/2025 |
| 10.0.0-rc.6 | 251 | 11/11/2025 |
| 10.0.0-rc.5 | 238 | 11/11/2025 |
| 10.0.0-rc.4 | 155 | 11/5/2025 |
| 10.0.0-rc.1 | 163 | 10/2/2025 |
| 9.0.0 | 3,370 | 11/13/2024 |
| 8.3.0 | 1,736 | 6/10/2024 |
| 8.2.0 | 9,195 | 11/28/2023 |
| 8.1.0 | 416 | 11/28/2023 |
| 8.0.0 | 430 | 11/14/2023 |
| 8.0.0-rc2 | 239 | 11/13/2023 |
| 8.0.0-rc1 | 244 | 11/6/2023 |
| 7.0.3 | 8,445 | 8/9/2023 |
| 7.0.2 | 2,607 | 12/6/2022 |
| 7.0.1 | 649 | 11/15/2022 |
| 7.0.0 | 684 | 11/14/2022 |
| 7.0.0-preview.1 | 240 | 10/30/2022 |
| 6.1.7 | 789 | 8/9/2023 |
| 6.1.6 | 6,216 | 12/6/2022 |
| 6.1.5 | 895 | 11/15/2022 |
| 6.1.4 | 1,137 | 10/28/2022 |
| 6.1.3 | 8,396 | 8/26/2022 |
| 6.1.2 | 972 | 8/26/2022 |
| 6.1.1 | 4,802 | 7/5/2022 |
| 6.1.0 | 1,065 | 7/5/2022 |
| 6.0.4 | 5,460 | 12/19/2021 |
| 6.0.3 | 699 | 12/8/2021 |
| 6.0.1 | 775 | 12/2/2021 |
| 6.0.0 | 1,606 | 12/2/2021 |
| 1.0.0 | 676 | 12/2/2021 |