AutoWire.Contract 1.1.1

dotnet add package AutoWire.Contract --version 1.1.1
                    
NuGet\Install-Package AutoWire.Contract -Version 1.1.1
                    
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="AutoWire.Contract" Version="1.1.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AutoWire.Contract" Version="1.1.1" />
                    
Directory.Packages.props
<PackageReference Include="AutoWire.Contract" />
                    
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 AutoWire.Contract --version 1.1.1
                    
#r "nuget: AutoWire.Contract, 1.1.1"
                    
#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 AutoWire.Contract@1.1.1
                    
#: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=AutoWire.Contract&version=1.1.1
                    
Install as a Cake Addin
#tool nuget:?package=AutoWire.Contract&version=1.1.1
                    
Install as a Cake Tool

AutoWire

Attribute-based automatic service registration for Microsoft's dependency injection container. Built on the AssembleMe framework.

AutoWire scans your assemblies at startup, finds methods marked with [AutoWire], and invokes them to register services — no more manually calling dozens of Add* extension methods from your Program.cs.

Packages

Package Description
AutoWire.Contract The [AutoWire] attribute
AutoWire.MicrosoftDependencyInjection Microsoft DI integration
AutoWire.Analyzer Roslyn analyzer for compile-time validation

Getting Started

Projects that define service registrations only need to reference AutoWire.Contract (and optionally the Analyzer for compile-time checks). Only the host project that bootstraps the DI container needs to reference AutoWire.MicrosoftDependencyInjection.

# In each library/domain project:
dotnet add package AutoWire.Contract
dotnet add package AutoWire.Analyzer

# In your host/startup project:
dotnet add package AutoWire.MicrosoftDependencyInjection

Usage

1. Define service registrations anywhere in your solution

Create static methods that accept an IServiceCollection and mark them with the [AutoWire] attribute:

using AutoWire;
using Microsoft.Extensions.DependencyInjection;

public static class OrderServices
{
    [AutoWire]
    public static void Register(IServiceCollection services)
    {
        services.AddScoped<IOrderRepository, OrderRepository>();
        services.AddScoped<IOrderService, OrderService>();
    }
}

Methods can be public or private, and can live in any class, in any assembly that gets discovered by AssembleMe. This way each project owns its own registrations, and the host doesn't need to know about them.

2. Wire everything up at startup

In your host project:

serviceCollection.AddAssembler(b => b.AddMicrosoftDependencyInjectionWiring());

That's it. AutoWire will discover and invoke all [AutoWire]-attributed methods across your assemblies.

Analyzer

The AutoWire.Analyzer package provides compile-time validation for [AutoWire] methods. It reports a warning (AW0001) if a decorated method does not have the correct signature (a single IServiceCollection parameter).

Method Requirements

Methods decorated with [AutoWire] must:

  • Be static
  • Have exactly one parameter of type IServiceCollection

Violations are caught both at compile-time (via the analyzer) and at runtime.

License

MIT

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on AutoWire.Contract:

Package Downloads
AutoWire.MicrosoftDependencyInjection

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.1.1 101 3/2/2026
1.1.0 112 2/9/2026
0.1.1-alpha 374 12/1/2023