diff --git a/Directory.Packages.props b/Directory.Packages.props
index d0a0f2d..b38a4e1 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -7,7 +7,7 @@
-
+
diff --git a/src/Immediate.Cache.Generators/Templates/ServiceCollectionExtensions.sbntxt b/src/Immediate.Cache.Generators/Templates/ServiceCollectionExtensions.sbntxt
index eb7ba17..83c03c4 100644
--- a/src/Immediate.Cache.Generators/Templates/ServiceCollectionExtensions.sbntxt
+++ b/src/Immediate.Cache.Generators/Templates/ServiceCollectionExtensions.sbntxt
@@ -23,7 +23,7 @@ public static partial class CacheServiceCollectionExtensions
);
{{~ end ~}}
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)
diff --git a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.InvalidHandlerReturn_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.InvalidHandlerReturn_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
index 6f3ae09..76b1d3b 100644
--- a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.InvalidHandlerReturn_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
+++ b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.InvalidHandlerReturn_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
@@ -10,7 +10,7 @@ public static partial class CacheServiceCollectionExtensions
this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services
)
{
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)
diff --git a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.NotHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.NotHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
index 6f3ae09..76b1d3b 100644
--- a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.NotHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
+++ b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.NotHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
@@ -10,7 +10,7 @@ public static partial class CacheServiceCollectionExtensions
this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services
)
{
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)
diff --git a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.StaticHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.StaticHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
index 6f3ae09..76b1d3b 100644
--- a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.StaticHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
+++ b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.StaticHandler_DoesNotGenerate#IC.ServiceCollectionExtensions.g.verified.cs
@@ -10,7 +10,7 @@ public static partial class CacheServiceCollectionExtensions
this global::Microsoft.Extensions.DependencyInjection.IServiceCollection services
)
{
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)
diff --git a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.ValidCache#IC.ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.ValidCache#IC.ServiceCollectionExtensions.g.verified.cs
index 3fe4091..d365bdc 100644
--- a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.ValidCache#IC.ServiceCollectionExtensions.g.verified.cs
+++ b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/CacheGenerationTests.ValidCache#IC.ServiceCollectionExtensions.g.verified.cs
@@ -17,7 +17,7 @@ public static partial class CacheServiceCollectionExtensions
)
);
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)
diff --git a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IC.ServiceCollectionExtensions.g.verified.cs b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IC.ServiceCollectionExtensions.g.verified.cs
index fb3c9d2..523338a 100644
--- a/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IC.ServiceCollectionExtensions.g.verified.cs
+++ b/tests/Immediate.Cache.Tests/GeneratorTests/Snapshots/ImmediateAssemblyIdentifierTests.ImmediateAssemblyIdentifierOverridesAssemblyName#IC.ServiceCollectionExtensions.g.verified.cs
@@ -17,7 +17,7 @@ public static partial class CacheServiceCollectionExtensions
)
);
- global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.Add(
+ global::Microsoft.Extensions.DependencyInjection.Extensions.ServiceCollectionDescriptorExtensions.TryAdd(
services,
global::Microsoft.Extensions.DependencyInjection.ServiceDescriptor.Singleton(
typeof(global::Immediate.Cache.Shared.Owned<>)