AutoWire.Contract
1.1.1
dotnet add package AutoWire.Contract --version 1.1.1
NuGet\Install-Package AutoWire.Contract -Version 1.1.1
<PackageReference Include="AutoWire.Contract" Version="1.1.1" />
<PackageVersion Include="AutoWire.Contract" Version="1.1.1" />
<PackageReference Include="AutoWire.Contract" />
paket add AutoWire.Contract --version 1.1.1
#r "nuget: AutoWire.Contract, 1.1.1"
#:package AutoWire.Contract@1.1.1
#addin nuget:?package=AutoWire.Contract&version=1.1.1
#tool nuget:?package=AutoWire.Contract&version=1.1.1
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
| Product | Versions 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. |
-
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 |