Skip to content

Commit 9cf6472

Browse files
committed
Allow conditional inclusion of the AddServices extension methods
1 parent 265bf07 commit 9cf6472

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

src/DependencyInjection/AddServicesNoReflectionExtension.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using System;
1+
// <auto-generated />
2+
#if DDI_ADDSERVICES
3+
using System;
24
using System.ComponentModel;
35
using Microsoft.Extensions.DependencyInjection;
46

@@ -122,4 +124,5 @@ public static IServiceCollection AddServices(this IServiceCollection services)
122124
[AttributeUsage(AttributeTargets.Method)]
123125
class DDIAddServicesAttribute : Attribute { }
124126
}
125-
}
127+
}
128+
#endif

src/DependencyInjection/Devlooped.Extensions.DependencyInjection.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<PropertyGroup>
44
<DevloopedExtensionsDependencyInjectionVersion>42.42.42</DevloopedExtensionsDependencyInjectionVersion>
55
<AddServiceAttribute Condition="'$(AddServiceAttribute)' == ''">true</AddServiceAttribute>
6+
<AddServicesExtension Condition="'$(AddServicesExtension)' == ''">true</AddServicesExtension>
67
</PropertyGroup>
78

89
<ItemGroup>

src/DependencyInjection/Devlooped.Extensions.DependencyInjection.targets

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
<!-- Backwards compatiblity -->
55
<AddServiceAttribute Condition="'$(IncludeServiceAttribute)' != ''">$(IncludeServiceAttribute)</AddServiceAttribute>
66
<DefineConstants Condition="'$(Language)' == 'C#' and '$(AddServiceAttribute)' == 'true'">$(DefineConstants);DDI_ADDSERVICE</DefineConstants>
7+
<DefineConstants Condition="'$(Language)' == 'C#' and '$(AddServicesExtension)' == 'true'">$(DefineConstants);DDI_ADDSERVICES</DefineConstants>
78
</PropertyGroup>
89

910
<Target Name="_AddDDI_Constant" BeforeTargets="CoreCompile">
1011
<PropertyGroup>
1112
<DefineConstants Condition="'$(Language)' == 'C#' and '$(AddServiceAttribute)' == 'true' and !$(DefineConstants.Contains('DDI_ADDSERVICE'))">$(DefineConstants);DDI_ADDSERVICE</DefineConstants>
13+
<DefineConstants Condition="'$(Language)' == 'C#' and '$(AddServicesExtension)' == 'true' and !$(DefineConstants.Contains('DDI_ADDSERVICES'))">$(DefineConstants);DDI_ADDSERVICES</DefineConstants>
1214
</PropertyGroup>
1315
</Target>
1416

0 commit comments

Comments
 (0)