Skip to content

Commit

Permalink
added an additional net48 target
Browse files Browse the repository at this point in the history
  • Loading branch information
Viacheslav Luchytskyi authored and jeremydmiller committed Apr 19, 2020
1 parent 50f0abe commit 301f325
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/Lamar.Testing/Lamar.Testing.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net461;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
<TargetFrameworks>net461;net48;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Baseline" Version="1.5.0" />
Expand Down
11 changes: 7 additions & 4 deletions src/Lamar/Lamar.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<Description>Fast ASP.Net Core compatible IoC Tool, Successor to StructureMap</Description>
<VersionPrefix>4.2.1</VersionPrefix>
<Authors>Jeremy D. Miller</Authors>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net48;netstandard2.0;netstandard2.1</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>Lamar</AssemblyName>
<PackageId>Lamar</PackageId>
Expand All @@ -22,15 +22,18 @@
<ItemGroup>
<ProjectReference Include="..\LamarCodeGeneration\LamarCodeGeneration.csproj" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);NET461</DefineConstants>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net48' ">
<DefineConstants>$(DefineConstants);NET4x</DefineConstants>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net461' ">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[2.0.0, 3.0.0)" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' ">
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[2.0.0, 4.0.0)" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="[2.0.0, 4.0.0)" />
Expand Down
6 changes: 3 additions & 3 deletions src/LamarCodeGeneration/Frames/MethodCall.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public MethodCall(Type handlerType, MethodInfo method) : base(method.IsAsync())
Type returnType = correctedReturnType(method.ReturnType);
if (returnType != null)
{
#if !NET461
#if !NET4x


if (returnType.IsValueTuple())
Expand All @@ -66,7 +66,7 @@ public MethodCall(Type handlerType, MethodInfo method) : base(method.IsAsync())

ReturnVariable = new Variable(returnType, name, this);

#if !NET461
#if !NET4x
}
#endif
}
Expand Down Expand Up @@ -215,7 +215,7 @@ public override void GenerateCode(GeneratedMethod method, ISourceWriter writer)
var isDisposable = false;
if (shouldAssignVariableToReturnValue(method))
{
#if !NET461
#if !NET4x
returnValue = ReturnVariable.VariableType.IsValueTuple() ? $"{ReturnVariable.Usage} = {returnValue}" : $"var {ReturnVariable.Usage} = {returnValue}";
#else
returnValue = $"var {ReturnVariable.Usage} = {returnValue}";
Expand Down
6 changes: 3 additions & 3 deletions src/LamarCodeGeneration/LamarCodeGeneration.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Description>Code Generation Chicanery for .Net</Description>
<VersionPrefix>1.4.0</VersionPrefix>
<Authors>Jeremy D. Miller</Authors>
<TargetFrameworks>net461;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>net461;net48;netstandard2.0;netstandard2.1</TargetFrameworks>
<DebugType>portable</DebugType>
<AssemblyName>LamarCodeGeneration</AssemblyName>
<PackageId>LamarCodeGeneration</PackageId>
Expand All @@ -18,8 +18,8 @@
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' ">
<DefineConstants>$(DefineConstants);NET461</DefineConstants>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net461' OR '$(TargetFramework)' == 'net48' ">
<DefineConstants>$(DefineConstants);NET4x</DefineConstants>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/LamarCodeGeneration/Util/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,7 @@ public static T GetAttribute<T>(this Type type) where T : Attribute
return type.GetTypeInfo().GetCustomAttributes<T>().FirstOrDefault();
}

#if !NET461
#if !NET4x
private static readonly Type[] _tupleTypes = new Type[]
{
typeof(ValueTuple<>),
Expand Down
2 changes: 1 addition & 1 deletion src/LamarCompiler.Testing/Samples/HelloWorld.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public HelloWorldSamples(ITestOutputHelper output)
{
_output = output;
}
#if !NET461
#if !NET4x

[Fact]
public void say_hello()
Expand Down
4 changes: 2 additions & 2 deletions src/LamarCompiler/AssemblyGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using Microsoft.CodeAnalysis.CSharp;
using LamarCodeGeneration.Util;

#if !NET461
#if !NET4x
using System.Runtime.Loader;
#endif

Expand Down Expand Up @@ -215,7 +215,7 @@ internal interface ILamarAssemblyLoadContext
Assembly LoadFromAssemblyPath(string assemblyName);
}

#if !NET461
#if !NET4x
public sealed class CustomAssemblyLoadContext : AssemblyLoadContext, ILamarAssemblyLoadContext
{
protected override Assembly Load(AssemblyName assemblyName)
Expand Down

0 comments on commit 301f325

Please sign in to comment.