Skip to content

Commit d3cf623

Browse files
authored
Merge pull request #11 from Sundow/master
net472, net6.0, net7.0 are added as build targets.
2 parents 7141af3 + d2b7f23 commit d3cf623

10 files changed

+30
-28
lines changed

source/Src/DatabaseTraceListener/Logging.Database.csproj

+2-14
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="..\..\..\package.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net45;net46;net47;netstandard2.0;netcoreapp2.0</TargetFrameworks>
5+
<TargetFrameworks>net45;net46;net47;net472;netstandard2.0;netcoreapp2.0;net6.0;net7.0</TargetFrameworks>
66

77
<AssemblyVersion>$(MajorVersion).0.0.0</AssemblyVersion>
88
<FileVersion>$(Version).$(Revision)</FileVersion>
@@ -37,11 +37,7 @@
3737
<ProjectReference Include="..\Logging\Logging.csproj" />
3838
</ItemGroup>
3939

40-
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) OR $(TargetFramework.StartsWith('netcoreapp'))">
41-
42-
</ItemGroup>
43-
44-
<ItemGroup Condition="!$(TargetFramework.StartsWith('netstandard')) AND !$(TargetFramework.StartsWith('netcoreapp'))">
40+
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
4541
<Reference Include="System.Configuration" />
4642
<Reference Include="System.Configuration.Install" />
4743
<Reference Include="System.Management" />
@@ -89,14 +85,6 @@
8985
</Content>
9086
</ItemGroup>
9187

92-
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) OR $(TargetFramework.StartsWith('netcoreapp'))">
93-
94-
</ItemGroup>
95-
96-
<ItemGroup Condition="!$(TargetFramework.StartsWith('netstandard')) AND !$(TargetFramework.StartsWith('netcoreapp'))">
97-
98-
</ItemGroup>
99-
10088
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
10189
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
10290
<DebugSymbols>true</DebugSymbols>

source/Src/Logging/Configuration/Fluent/ILoggingConfigurationSendToEventLogTraceListener.cs

-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
// Copyright (c) Microsoft Corporation. All rights reserved. See License.txt in the project root for license information.
22

3-
using System;
4-
using System.Collections.Generic;
5-
using System.Linq;
6-
using System.Text;
73
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;
84
using System.Diagnostics;
9-
using System.Messaging;
105
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;
11-
using System.Collections.Specialized;
126
using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;
13-
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Fluent;
147

158
namespace Microsoft.Practices.EnterpriseLibrary.Common.Configuration.Fluent
169
{

source/Src/Logging/Configuration/Fluent/SendToEventLogTraceListenerExtension.cs

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Text;
77
using Microsoft.Practices.EnterpriseLibrary.Logging.Configuration;
88
using System.Diagnostics;
9-
using System.Messaging;
109
using Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners;
1110
using System.Collections.Specialized;
1211
using Microsoft.Practices.EnterpriseLibrary.Logging.Formatters;

source/Src/Logging/ExtraInformation/UnmanagedSecurityContextInformationProvider.cs

+3
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ public string CurrentUser
5252
/// </summary>
5353
public string ProcessAccountName
5454
{
55+
// Warning disabled to allow debug builds for net 6/7.
56+
#pragma warning disable SYSLIB0003
5557
[SecurityPermission(SecurityAction.Demand, UnmanagedCode = true)]
58+
#pragma warning restore SYSLIB0003
5659
get
5760
{
5861
// Get Security Info

source/Src/Logging/Formatters/BinaryLogFormatter.cs

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace Microsoft.Practices.EnterpriseLibrary.Logging.Formatters
1010
{
11+
// Keeping obsolete binary formatter in net 6/7 build for a compatibility with old code using EnterpriseLibrary. If not disabled this warning generates warning as error in net 6/7.
12+
#pragma warning disable SYSLIB0011
1113
/// <summary>
1214
/// Log formatter that will format a <see cref="LogEntry"/> in a way suitable for wire transmission.
1315
/// </summary>
@@ -55,4 +57,5 @@ private static BinaryFormatter GetFormatter()
5557
return new BinaryFormatter();
5658
}
5759
}
60+
#pragma warning restore SYSLIB0011
5861
}

source/Src/Logging/LogEntry.cs

+3
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,11 @@ private bool UnmanagedCodePermissionAvailable
594594
{
595595
try
596596
{
597+
// Warning disabled to allow debug builds for net 6/7.
598+
#pragma warning disable SYSLIB0003
597599
SecurityPermission unmanagedCodePermission = new SecurityPermission(SecurityPermissionFlag.UnmanagedCode);
598600
unmanagedCodePermission.Demand();
601+
#pragma warning restore SYSLIB0003
599602
internalUnmanagedCodePermissionAvailable = true;
600603
}
601604
catch (SecurityException)

source/Src/Logging/LogWriter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ private static bool IsValidTraceSource(LogSource traceSource)
581581
return traceSource != null && traceSource.Listeners.Any();
582582
}
583583

584-
#if !NETSTANDARD2_0 && !NETCOREAPP2_0
584+
#if !NETSTANDARD2_0 && !NETCOREAPP2_0 && !NET6_0 && !NET7_0
585585
private void ProcessLog(LogEntry log, TraceEventCache traceEventCache)
586586
{
587587
// revert any outstanding impersonation

source/Src/Logging/Logging.csproj

+14-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="..\..\..\package.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net45;net46;net47;netstandard2.0;netcoreapp2.0</TargetFrameworks>
5+
<TargetFrameworks>net45;net46;net47;net472;netstandard2.0;netcoreapp2.0;net6.0-windows;net7.0-windows</TargetFrameworks>
66

77
<AssemblyVersion>$(MajorVersion).0.0.0</AssemblyVersion>
88
<FileVersion>$(Version).$(Revision)</FileVersion>
@@ -35,13 +35,17 @@
3535
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
3636
</ItemGroup>
3737

38-
<ItemGroup Condition="$(TargetFramework.StartsWith('netstandard')) OR $(TargetFramework.StartsWith('netcoreapp'))">
38+
<ItemGroup Condition="!$(TargetFramework.StartsWith('net4'))">
3939
<PackageReference Include="System.Configuration.ConfigurationManager" Version="$(SystemConfigurationConfigurationManagerVersion)" />
4040
<PackageReference Include="System.Security.Permissions" Version="$(SystemSecurityPermissionsVersion)" />
4141
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindowsVersion)" />
4242
</ItemGroup>
4343

44-
<ItemGroup Condition="!$(TargetFramework.StartsWith('netstandard')) AND !$(TargetFramework.StartsWith('netcoreapp'))">
44+
<ItemGroup Condition="$(TargetFramework.StartsWith('net6')) OR $(TargetFramework.StartsWith('net7'))">
45+
<PackageReference Include="System.Diagnostics.EventLog" Version="7.0.0" />
46+
</ItemGroup>
47+
48+
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
4549
<Reference Include="System.Configuration" />
4650
<Reference Include="System.Configuration.Install" />
4751
<Reference Include="System.EnterpriseServices" />
@@ -111,8 +115,14 @@
111115
<Compile Remove="ExtraInformation\Helpers\*ContextUtils.cs" />
112116
<Compile Remove="ExtraInformation\ComPlusInformationProvider.cs" />
113117
</ItemGroup>
118+
119+
<ItemGroup Condition="$(TargetFramework.StartsWith('net6')) OR $(TargetFramework.StartsWith('net7'))">
120+
<Compile Remove="**\*Msmq*.cs" />
121+
<Compile Remove="ExtraInformation\Helpers\*ContextUtils.cs" />
122+
<Compile Remove="ExtraInformation\ComPlusInformationProvider.cs" />
123+
</ItemGroup>
114124

115-
<ItemGroup Condition="!$(TargetFramework.StartsWith('netstandard')) AND !$(TargetFramework.StartsWith('netcoreapp'))">
125+
<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
116126
<Compile Remove="System.Runtime.Remoting.Messaging\*.cs" />
117127
</ItemGroup>
118128

source/Src/Logging/Tracer.cs

+3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,10 @@ private static void CheckPermissionsIfFullyTrusted()
187187
{
188188
if (Tracer.isFullyTrusted)
189189
{
190+
// Warning disabled to allow debug builds for net 6/7.
191+
#pragma warning disable SYSLIB0003
190192
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
193+
#pragma warning restore SYSLIB0003
191194
}
192195
}
193196

source/Src/MsmqDistributor/Logging.MsmqDistributor.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<Import Project="..\..\..\package.props" />
33

44
<PropertyGroup>
5-
<TargetFrameworks>net45;net46;net47</TargetFrameworks>
5+
<TargetFrameworks>net45;net46;net47;net472</TargetFrameworks>
66

77
<AssemblyVersion>$(MajorVersion).0.0.0</AssemblyVersion>
88
<FileVersion>$(Version).$(Revision)</FileVersion>

0 commit comments

Comments
 (0)