Skip to main content

Installation

This guide will help you install NetMediate and its companion packages in your .NET application.

Prerequisites

  • .NET 10.0, .NET Standard 2.0, or .NET Standard 2.1 compatible runtime
  • Visual Studio 2022+, Visual Studio Code, or JetBrains Rider
  • .NET CLI or NuGet Package Manager

Core Package Installation

dotnet add package NetMediate

After running the command, your .csproj will have a PackageReference for NetMediate. For library projects, optionally add PrivateAssets="all" to prevent NetMediate from flowing as a transitive dependency to consumers of your library:

<ItemGroup>
<!-- Application projects: no PrivateAssets needed -->
<PackageReference Include="NetMediate" Version="*" />

<!-- Library projects: add PrivateAssets to prevent transitive flow -->
<!-- <PackageReference Include="NetMediate" Version="*" PrivateAssets="all" /> -->
</ItemGroup>

Using Package Manager Console

Install-Package NetMediate

After running the command, your .csproj will have a PackageReference for NetMediate. See the note on PrivateAssets in the .NET CLI section above if you are building a library.

Using PackageReference

Add the following to your .csproj file:

<ItemGroup>
<PackageReference Include="NetMediate" Version="*" />
</ItemGroup>
Library projects: PrivateAssets

If you are building a library (not an application), consider adding PrivateAssets="all" to prevent NetMediate and its bundled source generator from flowing as a transitive dependency to consumers of your package. The analyzer runs for your project regardless — PrivateAssets only controls transitive flow.

<PackageReference Include="NetMediate" Version="*" PrivateAssets="all" />

Source Generation

The NetMediate.SourceGeneration analyzer is bundled inside the NetMediate package — you do not need to install it separately. It runs automatically for any project that directly references NetMediate.

Optional Packages

Resilience Package

Adds retry, timeout, and circuit breaker behaviors:

dotnet add package NetMediate.Resilience

Moq Testing Utilities

Provides testing helpers for unit tests:

dotnet add package NetMediate.Moq

Quartz Integration

For persistent notifications with Quartz.NET:

dotnet add package NetMediate.Quartz

Diagnostics Package

OpenTelemetry integration (included automatically with DataDog packages):

dotnet add package NetMediate.Diagnostics

DataDog Integrations

For DataDog observability:

# OpenTelemetry exporter
dotnet add package NetMediate.DataDog.OpenTelemetry

# Serilog sink
dotnet add package NetMediate.DataDog.Serilog

# ILogger integration
dotnet add package NetMediate.DataDog.ILogger

Version Compatibility

PackageMinimum .NET VersionSupported TFMs
NetMediate.NET Standard 2.0net10.0, netstandard2.0, netstandard2.1
NetMediate.SourceGeneration (bundled).NET Standard 2.0netstandard2.0 (analyzer)
NetMediate.Resilience.NET Standard 2.0net10.0, netstandard2.0, netstandard2.1
NetMediate.Moq.NET Standard 2.0net10.0, netstandard2.0, netstandard2.1
NetMediate.Quartz.NET Standard 2.0net10.0, netstandard2.0, netstandard2.1

Verifying Installation

After installation, verify that NetMediate is available in your project:

using NetMediate;
using Microsoft.Extensions.DependencyInjection;

var services = new ServiceCollection();
services.AddNetMediate(); // Generated by the bundled NetMediate.SourceGeneration analyzer

If AddNetMediate() is not recognized, make sure:

  1. Your PackageReference for NetMediate has PrivateAssets="all" set
  2. You've rebuilt your project
  3. Your IDE has refreshed its IntelliSense cache

Next Steps

Now that you have NetMediate installed, proceed to: