XmlWriterExtensions with #ifdefs (consistent to the rest)
diff --git a/src/log4net/Layout/Internal/XmlWriterExtensions.NetFx.cs b/src/log4net/Layout/Internal/XmlWriterExtensions.NetFx.cs
deleted file mode 100644
index 897ad3f..0000000
--- a/src/log4net/Layout/Internal/XmlWriterExtensions.NetFx.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using System.IO;
-using System.Xml;
-using log4net.Util;
-
-namespace log4net.Layout.Internal;
-
-partial class XmlWriterExtensions
-{
- /// <summary>
- /// Writes the specified start tag and associates it with the given namespace and prefix
- /// </summary>
- /// <param name="writer">Writer</param>
- /// <param name="fullName">The full name of the element</param>
- /// <param name="prefix">The namespace prefix of the element (ignored for net4x)</param>
- /// <param name="localName">The local name of the element (ignored for net4x)</param>
- /// <param name="ns">The namespace URI to associate with the element (ignored for net4x)</param>
- internal static void WriteStartElement(this XmlWriter writer,
- string fullName, string prefix, string localName, string ns)
- => writer.WriteStartElement(fullName);
-
- /// <summary>
- /// Creates an XmlWriter
- /// </summary>
- /// <param name="writer">TextWriter</param>
- /// <returns>XmlWriter</returns>
- internal static XmlWriter CreateXmlWriter(TextWriter writer)
- => new XmlTextWriter(new ProtectCloseTextWriter(writer))
- {
- Formatting = Formatting.None,
- Namespaces = false
- };
-}
diff --git a/src/log4net/Layout/Internal/XmlWriterExtensions.NetStandard.cs b/src/log4net/Layout/Internal/XmlWriterExtensions.NetStandard.cs
deleted file mode 100644
index 341f6a0..0000000
--- a/src/log4net/Layout/Internal/XmlWriterExtensions.NetStandard.cs
+++ /dev/null
@@ -1,34 +0,0 @@
-using System.IO;
-using System.Xml;
-using log4net.Util;
-
-namespace log4net.Layout.Internal;
-
-partial class XmlWriterExtensions
-{
- private static readonly XmlWriterSettings settings = new XmlWriterSettings
- {
- Indent = false,
- OmitXmlDeclaration = true
- };
-
- /// <summary>
- /// writes the specified start tag and associates it with the given namespace and prefix
- /// </summary>
- /// <param name="writer">Writer</param>
- /// <param name="fullName">The full name of the element (ignored for netstandard)</param>
- /// <param name="prefix">The namespace prefix of the element</param>
- /// <param name="localName">The local name of the element</param>
- /// <param name="ns">The namespace URI to associate with the element</param>
- internal static void WriteStartElement(this XmlWriter writer,
- string fullName, string prefix, string localName, string ns)
- => writer.WriteStartElement(prefix, localName, ns);
-
- /// <summary>
- /// Creates an XmlWriter
- /// </summary>
- /// <param name="writer">TextWriter</param>
- /// <returns>XmlWriter</returns>
- internal static XmlWriter CreateXmlWriter(TextWriter writer)
- => XmlWriter.Create(new ProtectCloseTextWriter(writer), settings);
-}
\ No newline at end of file
diff --git a/src/log4net/Layout/Internal/XmlWriterExtensions.cs b/src/log4net/Layout/Internal/XmlWriterExtensions.cs
index d5b17d5..c57a1b3 100644
--- a/src/log4net/Layout/Internal/XmlWriterExtensions.cs
+++ b/src/log4net/Layout/Internal/XmlWriterExtensions.cs
@@ -1,10 +1,55 @@
-namespace log4net.Layout.Internal;
+using System.IO;
+using System.Xml;
+using log4net.Util;
+
+namespace log4net.Layout.Internal;
/// <summary>
-/// Extensions for <see cref="System.Xml.XmlWriter"/>
+/// Extensions for <see cref="XmlWriter"/>
/// </summary>
/// <author>Jan Friedrich</author>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060:Remove unused parameter",
Justification = "Compatibility between net4 and netstandard")]
internal static partial class XmlWriterExtensions
-{ }
\ No newline at end of file
+{
+#if NETSTANDARD2_0_OR_GREATER
+ private static readonly XmlWriterSettings settings = new XmlWriterSettings
+ {
+ Indent = false,
+ OmitXmlDeclaration = true
+ };
+#endif
+
+ /// <summary>
+ /// writes the specified start tag and associates it with the given namespace and prefix
+ /// </summary>
+ /// <param name="writer">Writer</param>
+ /// <param name="fullName">The full name of the element</param>
+ /// <param name="prefix">The namespace prefix of the element</param>
+ /// <param name="localName">The local name of the element</param>
+ /// <param name="ns">The namespace URI to associate with the element</param>
+ internal static void WriteStartElement(this XmlWriter writer,
+ string fullName, string prefix, string localName, string ns)
+#if NETSTANDARD2_0_OR_GREATER
+ => writer.WriteStartElement(prefix, localName, ns);
+#else
+ => writer.WriteStartElement(fullName);
+#endif
+
+
+ /// <summary>
+ /// Creates an XmlWriter
+ /// </summary>
+ /// <param name="writer">TextWriter</param>
+ /// <returns>XmlWriter</returns>
+ internal static XmlWriter CreateXmlWriter(TextWriter writer)
+#if NETSTANDARD2_0_OR_GREATER
+ => XmlWriter.Create(new ProtectCloseTextWriter(writer), settings);
+#else
+ => new XmlTextWriter(new ProtectCloseTextWriter(writer))
+ {
+ Formatting = Formatting.None,
+ Namespaces = false
+ };
+#endif
+}
\ No newline at end of file
diff --git a/src/log4net/log4net.csproj b/src/log4net/log4net.csproj
index 67e1875..747b105 100644
--- a/src/log4net/log4net.csproj
+++ b/src/log4net/log4net.csproj
@@ -68,10 +68,12 @@
</PropertyGroup>
<PropertyGroup>
<BaseAddress>285212672</BaseAddress>
+ <DebugType>portable</DebugType>
+ <Deterministic>true</Deterministic>
<FileAlignment>4096</FileAlignment>
+ <PackageReadmeFile>README.md</PackageReadmeFile>
<RegisterForComInterop>false</RegisterForComInterop>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
- <Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)'=='Debug' ">
<DefineConstants>TRACE;DEBUG;$(DefineConstants)</DefineConstants>
@@ -100,18 +102,11 @@
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
</ItemGroup>
- <ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
- <None Include="**\*.NetStandard.cs" />
- <Compile Remove="**\*.NetStandard.cs" />
- </ItemGroup>
- <ItemGroup Condition="$(TargetFramework.StartsWith('netstandard'))">
- <None Include="**\*.NetFx.cs" />
- <Compile Remove="**\*.NetFx.cs" />
- </ItemGroup>
<ItemGroup>
<None Include="..\..\log4net.snk">
<Link>log4net.snk</Link>
</None>
+ <None Include="..\..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup Label="Packaging">
<Content Include="..\..\package-icon.png" PackagePath="package-icon.png">