MintPlayer.FolderHasher.Targets 10.1.0

dotnet add package MintPlayer.FolderHasher.Targets --version 10.1.0
                    
NuGet\Install-Package MintPlayer.FolderHasher.Targets -Version 10.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MintPlayer.FolderHasher.Targets" Version="10.1.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="MintPlayer.FolderHasher.Targets" Version="10.1.0" />
                    
Directory.Packages.props
<PackageReference Include="MintPlayer.FolderHasher.Targets">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add MintPlayer.FolderHasher.Targets --version 10.1.0
                    
#r "nuget: MintPlayer.FolderHasher.Targets, 10.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package MintPlayer.FolderHasher.Targets@10.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=MintPlayer.FolderHasher.Targets&version=10.1.0
                    
Install as a Cake Addin
#tool nuget:?package=MintPlayer.FolderHasher.Targets&version=10.1.0
                    
Install as a Cake Tool

MintPlayer.FolderHasher.Targets

MSBuild targets package for computing folder hashes. Just install this package to use the ComputeFolderHashTask in your build process - no additional configuration required.

Installation

dotnet add package MintPlayer.FolderHasher.Targets

Usage

After installing, the ComputeFolderHashTask is automatically available in your .csproj files:

<Target Name="ComputeClientAppHash" BeforeTargets="Build">
  <ComputeFolderHashTask FolderPath="$(MSBuildProjectDirectory)/ClientApp">
    <Output TaskParameter="Hash" PropertyName="ClientAppHash" />
  </ComputeFolderHashTask>
  <Message Text="Client app hash: $(ClientAppHash)" Importance="high" />
</Target>

Common Use Cases

Skip npm install when dependencies haven't changed

<Target Name="NpmInstall" BeforeTargets="Build">
  <ComputeFolderHashTask FolderPath="$(MSBuildProjectDirectory)/ClientApp">
    <Output TaskParameter="Hash" PropertyName="CurrentHash" />
  </ComputeFolderHashTask>

  <ReadLinesFromFile File="$(IntermediateOutputPath)npm-hash.txt"
                     Condition="Exists('$(IntermediateOutputPath)npm-hash.txt')">
    <Output TaskParameter="Lines" PropertyName="CachedHash" />
  </ReadLinesFromFile>

  <Exec Command="npm install" WorkingDirectory="$(MSBuildProjectDirectory)/ClientApp"
        Condition="'$(CurrentHash)' != '$(CachedHash)'" />

  <WriteLinesToFile File="$(IntermediateOutputPath)npm-hash.txt"
                    Lines="$(CurrentHash)" Overwrite="true" />
</Target>

Skip frontend build when source hasn't changed

<Target Name="BuildFrontend" BeforeTargets="Build">
  <ComputeFolderHashTask FolderPath="$(MSBuildProjectDirectory)/ClientApp/src">
    <Output TaskParameter="Hash" PropertyName="FrontendSourceHash" />
  </ComputeFolderHashTask>

  <ReadLinesFromFile File="$(IntermediateOutputPath)frontend-hash.txt"
                     Condition="Exists('$(IntermediateOutputPath)frontend-hash.txt')">
    <Output TaskParameter="Lines" PropertyName="CachedFrontendHash" />
  </ReadLinesFromFile>

  <Exec Command="npm run build" WorkingDirectory="$(MSBuildProjectDirectory)/ClientApp"
        Condition="'$(FrontendSourceHash)' != '$(CachedFrontendHash)'" />

  <WriteLinesToFile File="$(IntermediateOutputPath)frontend-hash.txt"
                    Lines="$(FrontendSourceHash)" Overwrite="true" />
</Target>

Using .hasherignore

Create a .hasherignore file in the folder being hashed to exclude files:

# Exclude build outputs
dist/
*.js.map

# Exclude test files
**/*.spec.ts
**/*.test.ts

# Exclude IDE files
.idea/
.vscode/

Task Properties

Input

Property Required Description
FolderPath Yes Absolute path to the folder to hash

Output

Property Description
Hash 64-character lowercase hex string (SHA256)

Features

  • Zero configuration - Just install and use
  • .hasherignore support - Exclude files with gitignore-style patterns
  • Large file streaming - Memory-efficient hashing of large files (>10MB)
  • Graceful error handling - Skips inaccessible files/directories
  • Deterministic - Same contents always produce the same hash

Package Contents

This package is a development dependency that includes:

  • MSBuild targets for automatic task registration
  • MintPlayer.FolderHasher.MSBuild.dll - The MSBuild task
  • Required runtime dependencies

License

Apache-2.0

There are no supported framework assets in this package.

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.

Version Downloads Last Updated
10.1.0 147 2/1/2026