AddLib 1.0.3
See the version list below for details.
dotnet add package AddLib --version 1.0.3
NuGet\Install-Package AddLib -Version 1.0.3
<PackageReference Include="AddLib" Version="1.0.3" />
<PackageVersion Include="AddLib" Version="1.0.3" />
<PackageReference Include="AddLib" />
paket add AddLib --version 1.0.3
#r "nuget: AddLib, 1.0.3"
#:package AddLib@1.0.3
#addin nuget:?package=AddLib&version=1.0.3
#tool nuget:?package=AddLib&version=1.0.3
AddLib 
Ever been annoyed that your application's entry point, Program.cs, must
know about the whole dependency graph of every project in your solution to
be able to configure the DI container?
Ever been annoyed that you can't mark a class or interface as internal because
it makes them difficult to use via Dependency Injection?
AddLib can help you 🎉
AddLib provides a simple convention for encapsulating the internal types and functionality of class libraries.
Installation
dotnet add package AddLib
AddLib has a single external reference to the lightweight
Microsoft.Extensions.DependencyInjection.Abstractions package, which will
also be installed implicitly.
How to use
In your class library project, add a class that implements AddLib.ILibrary:
using Microsoft.Extensions.DependencyInjection;
namespace MySolution.Domain;
public class Library : AddLib.ILibrary
{
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<IInternalDomainUtility, InternalDomainUtility>();
services.AddTransient<IUserDomainService, UserDomainService>();
}
}
In your application entry point, e.g. Program.cs, register the Library
by pointing to the type:
services.AddLibrary<MySolution.Domain.Library>();
Or let AddLib scan assemblies for the ILibrary implementations:
// Scans the given assembly
services.AddLibrary(typeof(MySolution.Domain.IUserDomainService).Assembly);
// Scans all loaded assemblies matching a pattern
services.AddLibraries("MySolution.*");
Making internal visible to tests
You might ask: "Don't I still need to make all the classes and interfaces
public so I can reference them in test projects?"
Not necessarily. You can use the InternalsVisibleTo attribute.
Either in your Project.csproj or Directory.Build.props:
<ItemGroup>
<AssemblyAttribute Include="System.Runtime.CompilerServices.InternalsVisibleToAttribute">
<_Parameter1>MySolution.UnitTests</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
Or as code, placed anywhere in your library project:
[assembly: InternalsVisibleTo("MySolution.UnitTests")]
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.5 | 352 | 4/23/2023 |
| 1.0.3 | 399 | 2/4/2023 |
| 1.0.1 | 454 | 11/12/2022 |
| 0.1.16 | 449 | 11/12/2022 |
| 0.1.15 | 429 | 11/12/2022 |
| 0.1.14-alpha | 244 | 11/12/2022 |
| 0.1.12-alpha | 229 | 11/12/2022 |
| 0.1.8-alpha | 230 | 11/5/2022 |
| 0.1.7-alpha | 266 | 4/27/2022 |
| 0.1.6-alpha | 275 | 4/27/2022 |
| 0.1.5-alpha | 268 | 4/27/2022 |
| 0.1.4-alpha | 273 | 4/27/2022 |