Skip to content

Commit

Permalink
Merge pull request #311 from 0xced/target-framework-cleanup
Browse files Browse the repository at this point in the history
Remove out of support target frameworks
  • Loading branch information
nblumhardt authored May 13, 2022
2 parents 2045959 + 3f9593e commit 60157bd
Show file tree
Hide file tree
Showing 12 changed files with 117 additions and 163 deletions.
8 changes: 2 additions & 6 deletions Build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,8 @@ foreach ($test in dir test/*.Tests) {
echo "build: Testing project in $test"

if ($PSVersionTable.Platform -eq "Unix") {
& dotnet test -c Release -f netcoreapp2.1
& dotnet test -c Release -f netcoreapp3.1
& dotnet test -c Release -f net50
& dotnet test -c Release -f net6.0
} else {
& dotnet test -c Release
}
Expand All @@ -58,13 +57,10 @@ foreach ($test in dir test/*.Tests) {
if ($PSVersionTable.Platform -eq "Unix") {
Push-Location sample/Sample

& dotnet run -f netcoreapp2.1 -c Release --run-once
if ($LASTEXITCODE -ne 0) { exit 4 }

& dotnet run -f netcoreapp3.1 -c Release --run-once
if ($LASTEXITCODE -ne 0) { exit 4 }

& dotnet run -f net50 -c Release --run-once
& dotnet run -f net6.0 -c Release --run-once
if ($LASTEXITCODE -ne 0) { exit 4 }

Pop-Location
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
</PropertyGroup>

<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: '{build}'
skip_tags: true
image:
- Visual Studio 2019
- Visual Studio 2022
- Ubuntu
configuration: Release
build_script:
Expand Down
34 changes: 8 additions & 26 deletions sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,43 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net50;netcoreapp3.1;netcoreapp2.1;net46</TargetFrameworks>
<TargetFrameworks>net6.0;netcoreapp3.1;net462</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net46' ">
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
<PreserveCompilationContext>false</PreserveCompilationContext>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\Serilog.Settings.Configuration\Serilog.Settings.Configuration.csproj" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net46'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="1.1.1" />
<PackageReference Include="Serilog.Filters.Expressions" Version="2.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.1'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="2.1.1" />
<PackageReference Include="Serilog.Filters.Expressions" Version="2.1.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.10" />
<PackageReference Include="Serilog.Expressions" Version="1.0.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net50'">
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="5.0.0" />
<PackageReference Include="Serilog.Expressions" Version="1.0.0" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Serilog.Sinks.Async" Version="1.4.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
<PackageReference Include="Serilog.Sinks.File" Version="4.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.5.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="2.2.0" />
<PackageReference Include="Serilog.Expressions" Version="3.3.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="1.1.0" />
<PackageReference Include="Serilog.Enrichers.Thread" Version="3.1.0" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,18 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
</PropertyGroup>

<PropertyGroup Condition="('$(TargetFramework)' == 'net451') Or ('$(TargetFramework)' == 'net461')">
<DefineConstants>$(DefineConstants);PRIVATE_BIN</DefineConstants>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All"/>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="3.0.0" />
<PackageReference Include="Serilog" Version="2.10.0" />
<None Include="..\..\assets\icon.png" Pack="true" PackagePath=""/>
<None Include="..\..\assets\icon.png" Pack="true" PackagePath="" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net451'">
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="1.1.2" />

<ItemGroup Condition="$(TargetFramework) == 'net451'">
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="1.1.2" />
</ItemGroup>

<ItemGroup Condition="('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net461')">
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="2.0.0" />
<ItemGroup Condition="$(TargetFramework) != 'net451'">
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.0.0" />
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand All @@ -16,7 +16,7 @@ public override IReadOnlyList<AssemblyName> FindAssembliesContainingName(string
{
probeDirs.Add(AppDomain.CurrentDomain.BaseDirectory);

#if PRIVATE_BIN
#if NETFRAMEWORK
var privateBinPath = AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
if (!string.IsNullOrEmpty(privateBinPath))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ public void WriteToSupportSimplifiedSyntax()
Assert.True(result.Contains("LiterateConsole"));
Assert.True(result.Contains("DiagnosticTrace"));

Assert.Equal(1, result["LiterateConsole"].Count());
Assert.Equal(1, result["DiagnosticTrace"].Count());
Assert.Single(result["LiterateConsole"]);
Assert.Single(result["DiagnosticTrace"]);
}

[Fact]
Expand All @@ -49,7 +49,7 @@ public void WriteToSupportExpandedSyntaxWithoutArgs()
Assert.Equal(1, result.Count);
Assert.True(result.Contains("LiterateConsole"));

Assert.Equal(1, result["LiterateConsole"].Count());
Assert.Single(result["LiterateConsole"]);
}

[Fact]
Expand All @@ -67,14 +67,14 @@ public void WriteToSupportExpandedSyntaxWithArgs()

var result = _configurationReader.GetMethodCalls(JsonStringConfigSource.LoadSection(json, "WriteTo"));

Assert.Equal(1, result.Count);
Assert.Single(result);
Assert.True(result.Contains("LiterateConsole"));

Assert.Equal(1, result["LiterateConsole"].Count());
Assert.Single(result["LiterateConsole"]);

var args = result["LiterateConsole"].Single().ToArray();

Assert.Equal(1, args.Length);
Assert.Single(args);
Assert.Equal("outputTemplate", args[0].Key);
Assert.Equal("{Message}", args[0].Value.ConvertTo(typeof(string), new ResolutionContext()));
}
Expand Down Expand Up @@ -114,8 +114,8 @@ public void WriteToSupportMultipleSinksOfTheSameKind()
Assert.True(result.Contains("DiagnosticTrace"));
Assert.True(result.Contains("File"));

Assert.Equal(1, result["LiterateConsole"].Count());
Assert.Equal(1, result["DiagnosticTrace"].Count());
Assert.Single(result["LiterateConsole"]);
Assert.Single(result["DiagnosticTrace"]);
Assert.Equal(2, result["File"].Count());
}

Expand All @@ -133,9 +133,9 @@ public void Enrich_SupportSimplifiedSyntax()
Assert.True(result.Contains("WithMachineName"));
Assert.True(result.Contains("WithThreadId"));

Assert.Equal(1, result["FromLogContext"].Count());
Assert.Equal(1, result["WithMachineName"].Count());
Assert.Equal(1, result["WithThreadId"].Count());
Assert.Single(result["FromLogContext"]);
Assert.Single(result["WithMachineName"]);
Assert.Single(result["WithThreadId"]);
}

[Fact]
Expand Down
Loading

0 comments on commit 60157bd

Please sign in to comment.