ResolutionGuard.NuGet 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package ResolutionGuard.NuGet --version 0.1.0
                    
NuGet\Install-Package ResolutionGuard.NuGet -Version 0.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="ResolutionGuard.NuGet" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ResolutionGuard.NuGet" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="ResolutionGuard.NuGet" />
                    
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 ResolutionGuard.NuGet --version 0.1.0
                    
#r "nuget: ResolutionGuard.NuGet, 0.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 ResolutionGuard.NuGet@0.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=ResolutionGuard.NuGet&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=ResolutionGuard.NuGet&version=0.1.0
                    
Install as a Cake Tool

ResolutionGuard.NuGet

ResolutionGuard.NuGet Icon

Japanese README: README.ja.md

ResolutionGuard.NuGet is an MSBuild Task package that inspects restored obj/project.assets.json files and reports NuGet package-version mismatches across projects.

Disclaimer

  • Unofficial tool for managing NuGet dependency resolution.
  • Not affiliated with Microsoft or NuGet.

Project Philosophy

This project focuses on practical collaboration and respectful technical discussion. Contributions are welcome, while final decisions remain with the maintainers.

Why

NuGet dependency resolution is performed per entry project. A solution can silently resolve different versions of the same package in different startup points, even when NU1605/NU1107 does not fail the build. This package detects that situation after restore.

Security and behavior

  • This package modifies build behavior via .props/.targets.
  • The task runs AfterTargets="Build" when enabled.
  • The task only reads local files (**/obj/project.assets.json, optional nuget-resolution-guard.json).
  • The task does not execute external commands and does not perform network calls.
  • Default behavior is opt-in: ResolutionGuardNuGetEnabled=false unless explicitly enabled.

Requirements

  • SDK-style projects using dotnet restore/build (cross-platform)

Validated Environments

  • .NET SDK 8.0.x
  • .NET SDK 10.0.x

Install

<ItemGroup>
  <PackageReference Include="ResolutionGuard.NuGet" Version="0.1.0" PrivateAssets="all" />
</ItemGroup>

Enable

Set in Directory.Build.props (or CI properties):

<Project>
  <PropertyGroup>
    <ResolutionGuardNuGetEnabled>true</ResolutionGuardNuGetEnabled>
  </PropertyGroup>
</Project>

Configuration file

Default search file name: nuget-resolution-guard.json (searches from project directory upward).

You can override with MSBuild property:

<ResolutionGuardNuGetConfigFile>path/to/nuget-resolution-guard.json</ResolutionGuardNuGetConfigFile>

Example:

{
  "mode": "warning",
  "directOnly": false,
  "runtimeOnly": false,
  "excludeEntrypoints": [
    "src/ExperimentalApp/ExperimentalApp.csproj"
  ],
  "excludePackageIds": [
    "Microsoft.NETCore.App",
    "Microsoft.AspNetCore.App"
  ],
  "rules": [
    { "packageId": "Newtonsoft.Json", "mode": "error" },
    { "packageId": "Plugin.SDK", "mode": "error", "versions": ["1.2.0", "1.3.0"] }
  ]
}

Notes:

  • By default, all discovered projects and package IDs are analyzed.
  • directOnly is optional (false by default). When true, only directly referenced packages are analyzed.
  • runtimeOnly is optional (false by default). When true, only packages with runtime assets are analyzed.
  • excludeEntrypoints is an entry-project exclude-list (blacklist).
  • excludePackageIds is package exclude-list (blacklist).
  • rules[].mode overrides the global mode for that package ID.
  • rules[].versions is optional. Listed versions are treated as allowed, and any other resolved version follows rules[].mode.

MSBuild properties

  • ResolutionGuardNuGetEnabled (true|false)
  • ResolutionGuardNuGetConfigFile
  • ResolutionGuardNuGetMode (off|info|warning|error)
  • ResolutionGuardNuGetDirectOnly (true|false)
  • ResolutionGuardNuGetRuntimeOnly (true|false)
  • ResolutionGuardNuGetExcludedEntrypoints (; separated csproj paths to exclude)
  • ResolutionGuardNuGetExcludedPackageIds (; separated package ids to exclude)
  • ResolutionGuardNuGetRepositoryRoot (search root override)

Output behavior

  • error: build fails (Log.LogError)
  • warning: warning only (Log.LogWarning)
  • info: message only (Log.LogMessage)
  • off: no output for that package

Documentation

  • Japanese user guide: README.ja.md
  • Contributing guide: CONTRIBUTING.md
  • Code of Conduct: CODE_OF_CONDUCT.md
  • Development guide: docs/development.md
  • Trusted Publishing guide: docs/trusted-publishing.md
  • Security policy: SECURITY.md
  • Support policy: .github/SUPPORT.md
  • Changelog: CHANGELOG.md

License

  • This project is licensed under the MIT License. See LICENSE for the full license text.
  • Japanese license translation is available in LICENSE.ja.md.
  • Third-party license notices are listed in THIRD-PARTY-NOTICES.md.
There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

  • .NETStandard 2.0

    • No dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 0 3/2/2026
1.0.1 0 3/2/2026
0.1.1 0 2/27/2026
0.1.0 0 2/27/2026