Skip to content

Commit c779b31

Browse files
committed
feat: Upgrade target framework
1 parent b5a831f commit c779b31

File tree

13 files changed

+147
-189
lines changed

13 files changed

+147
-189
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ language: csharp
22
mono: none
33
sudo: required
44
dist: xenial
5-
dotnet: 3.0
5+
dotnet: 6.0
66
addons:
77
branches:
88
- dev
99
- master
1010
script:
1111
- dotnet restore src/LoggingTest
12-
- dotnet test src/LoggingTest -f netcoreapp3.0
12+
- dotnet test src/LoggingTest

src/Es.Logging.Console/ConsoleLogger.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System;
22
using System.Globalization;
3-
#if NETSTANDARD
3+
#if !NET462
44
using System.Runtime.InteropServices;
55
#endif
66
namespace Es.Logging
@@ -19,7 +19,7 @@ internal class ConsoleLogger : ILogger
1919

2020
static ConsoleLogger()
2121
{
22-
#if !NETFULL
22+
#if !NET462
2323
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
2424
{
2525
_console = new WindowsLogConsole();
Lines changed: 14 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,22 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\..\build\common.props" />
3-
4-
<PropertyGroup>
5-
<AssemblyName>Es.Logging.Console</AssemblyName>
6-
<AssemblyTitle>Es.Logging.Console</AssemblyTitle>
7-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
8-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9-
<PackageId>Es.Logging.Console</PackageId>
10-
</PropertyGroup>
2+
<Import Project="..\..\build\common.props" />
113

12-
<ItemGroup>
13-
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
14-
</ItemGroup>
4+
<PropertyGroup>
5+
<AssemblyName>Es.Logging.Console</AssemblyName>
6+
<AssemblyTitle>Es.Logging.Console</AssemblyTitle>
7+
<TargetFrameworks>net462;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
8+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
9+
<PackageId>Es.Logging.Console</PackageId>
10+
</PropertyGroup>
1511

12+
<ItemGroup>
13+
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
14+
</ItemGroup>
1615

17-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
18-
<Reference Include="System" />
19-
<Reference Include="Microsoft.CSharp" />
20-
</ItemGroup>
2116

22-
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0' ">
23-
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
24-
</PropertyGroup>
25-
26-
<PropertyGroup Condition="'$(TargetFramework)' == 'net45' ">
27-
<DefineConstants>$(DefineConstants);NETFULL</DefineConstants>
28-
</PropertyGroup>
17+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net462' ">
18+
<DefineConstants>$(DefineConstants);NET462</DefineConstants>
19+
</PropertyGroup>
2920

3021

3122
</Project>
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<Import Project="..\..\build\common.props" />
3+
<Import Project="..\..\build\common.props" />
44

5-
<PropertyGroup>
6-
<AssemblyName>Es.Logging.Log4</AssemblyName>
7-
<AssemblyTitle>Es.Logging.Log4</AssemblyTitle>
8-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
9-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10-
<PackageId>Es.Logging.Log4</PackageId>
11-
</PropertyGroup>
5+
<PropertyGroup>
6+
<AssemblyName>Es.Logging.Log4</AssemblyName>
7+
<AssemblyTitle>Es.Logging.Log4</AssemblyTitle>
8+
<TargetFrameworks>net462;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
9+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10+
<PackageId>Es.Logging.Log4</PackageId>
11+
</PropertyGroup>
1212

13-
<ItemGroup>
14-
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
15-
</ItemGroup>
13+
<ItemGroup>
14+
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
15+
</ItemGroup>
1616

17-
<ItemGroup>
18-
<PackageReference Include="log4net" Version="2.0.10" />
19-
</ItemGroup>
17+
<ItemGroup>
18+
<PackageReference Include="log4net" Version="2.0.14" />
19+
</ItemGroup>
2020
</Project>
Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<Import Project="..\..\build\common.props" />
4-
5-
<PropertyGroup>
6-
<AssemblyName>Es.Logging.NLog</AssemblyName>
7-
<AssemblyTitle>Es.Logging.NLog</AssemblyTitle>
8-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
9-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10-
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11-
<PackageId>Es.Logging.NLog</PackageId>
12-
</PropertyGroup>
13-
14-
<ItemGroup>
15-
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
16-
</ItemGroup>
17-
18-
<ItemGroup>
19-
<PackageReference Include="NLog" Version="4.6.8" />
20-
</ItemGroup>
21-
22-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
23-
<Reference Include="System.Xml" />
24-
<Reference Include="System" />
25-
<Reference Include="Microsoft.CSharp" />
26-
</ItemGroup>
27-
28-
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
29-
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
30-
</PropertyGroup>
31-
32-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
33-
<DefineConstants>$(DefineConstants);NETFULL</DefineConstants>
34-
</PropertyGroup>
3+
<Import Project="..\..\build\common.props" />
4+
5+
<PropertyGroup>
6+
<AssemblyName>Es.Logging.NLog</AssemblyName>
7+
<AssemblyTitle>Es.Logging.NLog</AssemblyTitle>
8+
<TargetFrameworks>net462;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
9+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
11+
<PackageId>Es.Logging.NLog</PackageId>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<PackageReference Include="NLog" Version="4.7.14" />
20+
</ItemGroup>
21+
22+
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
23+
<Reference Include="System.Xml" />
24+
<Reference Include="System" />
25+
<Reference Include="Microsoft.CSharp" />
26+
</ItemGroup>
27+
28+
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
29+
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
30+
</PropertyGroup>
31+
32+
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
33+
<DefineConstants>$(DefineConstants);NETFULL</DefineConstants>
34+
</PropertyGroup>
3535

3636
</Project>

src/Es.Logging.NLog/NLogLoggerFactoryExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ public static ILoggerFactory AddNLog(this ILoggerFactory factory, string fileNam
2020
{
2121
if (!string.IsNullOrEmpty(fileName) && File.Exists(fileName))
2222
{
23-
LogManager.Configuration = new XmlLoggingConfiguration(fileName, true);
23+
LogManager.Configuration = new XmlLoggingConfiguration(fileName);
2424
}
2525

26-
#if NETFULL
26+
#if NET462
2727
LogManager.AddHiddenAssembly(typeof(NLogLoggerFactoryExtensions).Assembly);
2828
#else
2929
LogManager.AddHiddenAssembly(typeof(NLogLoggerFactoryExtensions).GetTypeInfo().Assembly);

src/Es.Logging.Serilog/Es.Logging.Serilog.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<Description>Support for Serilog</Description>
55
<AssemblyName>Es.Logging.Serilog</AssemblyName>
66
<AssemblyTitle>Es.Logging.Serilog</AssemblyTitle>
7-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
7+
<TargetFrameworks>net462;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<PackageId>Es.Logging.Serilog</PackageId>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Serilog" Version="2.9.0" />
18+
<PackageReference Include="Serilog" Version="2.10.0" />
1919
</ItemGroup>
2020

2121
</Project>

src/Es.Logging/Es.Logging.csproj

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,10 @@
55
<PropertyGroup>
66
<AssemblyName>Es.Logging</AssemblyName>
77
<AssemblyTitle>Es.Logging</AssemblyTitle>
8-
<TargetFrameworks>netstandard2.0;net45</TargetFrameworks>
8+
<TargetFrameworks>net462;netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
99
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
1010
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1111
<PackageId>Es.Logging</PackageId>
1212
</PropertyGroup>
1313

14-
<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
15-
<Reference Include="System" />
16-
<Reference Include="Microsoft.CSharp" />
17-
</ItemGroup>
18-
19-
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
20-
<DefineConstants>$(DefineConstants);NETSTANDARD</DefineConstants>
21-
</PropertyGroup>
22-
23-
<PropertyGroup Condition=" '$(TargetFramework)' == 'net45'">
24-
<DefineConstants>$(DefineConstants);NETFULL</DefineConstants>
25-
</PropertyGroup>
26-
27-
28-
2914
</Project>

src/Es.Logging/LoggerFactory.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ public ILogger CreateLogger(string name)
6464
}
6565

6666

67-
#if NETFULL || NETSTANDARD2_0
6867

6968
/// <summary>
7069
/// 根据当前类名创建一个日志记录实例
@@ -76,7 +75,6 @@ public static ILogger GetCurrentClassLogger() {
7675
return Factory.CreateLogger(frame.GetMethod().DeclaringType.FullName);
7776
}
7877

79-
#endif
8078

8179
/// <summary>
8280
/// 根据名称创建一个日志记录实例
Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,29 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
<Import Project="..\..\build\common.props" />
3-
<PropertyGroup>
4-
<Description>Support for Microsoft.Extensions.Logging</Description>
5-
<AssemblyName>Es.Microsoft.Logging</AssemblyName>
6-
<AssemblyTitle>Es.Microsoft.Logging</AssemblyTitle>
7-
<TargetFrameworks>netstandard2.0;</TargetFrameworks>
8-
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9-
<PackageId>Es.Microsoft.Logging</PackageId>
10-
</PropertyGroup>
2+
<Import Project="..\..\build\common.props" />
3+
<PropertyGroup>
4+
<Description>Support for Microsoft.Extensions.Logging</Description>
5+
<AssemblyName>Es.Microsoft.Logging</AssemblyName>
6+
<AssemblyTitle>Es.Microsoft.Logging</AssemblyTitle>
7+
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net5.0;net6.0</TargetFrameworks>
8+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
9+
<PackageId>Es.Microsoft.Logging</PackageId>
10+
</PropertyGroup>
1111

12-
<ItemGroup>
13-
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
14-
</ItemGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="..\Es.Logging\Es.Logging.csproj" />
14+
</ItemGroup>
15+
16+
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
17+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
18+
</ItemGroup>
19+
<ItemGroup Condition=" '$(TargetFramework)' == 'netcoreapp3.1'">
20+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="3.1.0" />
21+
</ItemGroup>
22+
<ItemGroup Condition=" '$(TargetFramework)' == 'net5.0'">
23+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="5.0.0" />
24+
</ItemGroup>
25+
<ItemGroup Condition=" '$(TargetFramework)' == 'net6.0'">
26+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" />
27+
</ItemGroup>
1528

16-
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">
17-
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.0.0" />
18-
</ItemGroup>
1929
</Project>

0 commit comments

Comments
 (0)