- add targetFramework .net45

- change creation of empty array for .net45
pull/32/head v1.1.0-beta2
Simon Gockner 7 years ago
parent 29fbf4b0ad
commit 6782c8e1e9
  1. 4
      LightweightIocContainer/LightweightIocContainer.csproj
  2. 5
      LightweightIocContainer/Registrations/TypedFactoryRegistration.cs
  3. 2
      Test.LightweightIocContainer/Test.LightweightIocContainer.csproj

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
<Authors>SimonG</Authors> <Authors>SimonG</Authors>
<Copyright>Copyright(c) 2019 SimonG. All Rights Reserved.</Copyright> <Copyright>Copyright(c) 2019 SimonG. All Rights Reserved.</Copyright>
<Description>A lightweight IOC Container that is powerful enough to do all the things you need it to do.</Description> <Description>A lightweight IOC Container that is powerful enough to do all the things you need it to do.</Description>
@ -10,6 +10,7 @@
<LangVersion>latest</LangVersion> <LangVersion>latest</LangVersion>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageProjectUrl>https://github.com/SimonG96/LightweightIocContainer</PackageProjectUrl> <PackageProjectUrl>https://github.com/SimonG96/LightweightIocContainer</PackageProjectUrl>
<Version>1.1.0-beta2</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -20,6 +21,7 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2019.1.1" /> <PackageReference Include="JetBrains.Annotations" Version="2019.1.1" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" /> <PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

@ -115,8 +115,13 @@ namespace LightweightIocContainer.Registrations
} }
else else
{ {
#if NET45
generator.Emit(OpCodes.Ldc_I4_0);
generator.Emit(OpCodes.Newarr, typeof(object));
#elif NETSTANDARD
MethodInfo emptyArray = typeof(Array).GetMethod(nameof(Array.Empty))?.MakeGenericMethod(typeof(object)); MethodInfo emptyArray = typeof(Array).GetMethod(nameof(Array.Empty))?.MakeGenericMethod(typeof(object));
generator.EmitCall(OpCodes.Call, emptyArray, null); generator.EmitCall(OpCodes.Call, emptyArray, null);
#endif
} }
generator.EmitCall(OpCodes.Callvirt, typeof(IIocContainer).GetMethod(nameof(IIocContainer.Resolve), new[] { typeof(Type), typeof(object[])}), null); generator.EmitCall(OpCodes.Callvirt, typeof(IIocContainer).GetMethod(nameof(IIocContainer.Resolve), new[] { typeof(Type), typeof(object[])}), null);

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFrameworks>netcoreapp2.1;net45</TargetFrameworks>
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
</PropertyGroup> </PropertyGroup>

Loading…
Cancel
Save