.NET Framework 4.6.1
There is a newer version of this package available.
See the version list below for details.
dotnet add package Guard.NET --version
NuGet\Install-Package Guard.NET -Version
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="Guard.NET" Version="" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Guard.NET --version
#r "nuget: Guard.NET,"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Guard.NET as a Cake Addin
#addin nuget:?package=Guard.NET&version=

// Install Guard.NET as a Cake Tool
#tool nuget:?package=Guard.NET&version=

A simple library that facilitates runtime checks of code and allows to define preconditions and invariants within a method.

Product Versions
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages (43)

Showing the top 5 NuGet packages that depend on Guard.NET:

Package Downloads

Provides capability to improve telemetry with Serilog in applications


Provides capability to use correlation in applications


Provides capability to improve telemetry with Serilog in applications


Contains core functionality for Arcus.Security


Provides support for Azure Key Vault

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Guard.NET:

Repository Stars
Bringing Azure Monitor metrics where you need them.
Version Downloads Last updated
3.0.0 55,204 8/26/2022
2.0.0 153,154 10/5/2021
1.2.0 591,059 8/24/2018
1.0.1 678 8/23/2018 4,037 6/25/2018 822 6/19/2018
1.0.0 799 4/10/2018

       - issue with Guard.NotNullOrWhitespace overload obstruction:
         Guard.NotNullOrWhitespace optionally allows you to specify a guard message.
         However, it is being enforced by the compiler because there is an overload which is interfering.