Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for netstandard2.0 only #118

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -183,3 +183,5 @@ UpgradeLog*.htm
# Microsoft Fakes
FakesAssemblies/
/.vs

.dotnetcli
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
2.5.0
* remove MailKit and support for net4.5, net 4.8, netstandard1.3, netstandard2.1

2.2.2
* allow disabling SMTP SSL certification validation

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Sends log events by SMTP email.

**Package** - [Serilog.Sinks.Email](http://nuget.org/packages/serilog.sinks.email)
| **Platforms** - .NET 4.5


```csharp
var log = new LoggerConfiguration()
Expand Down
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
test: off
Expand Down
5 changes: 1 addition & 4 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,11 @@ dotnet restore

echo "🤖 Attempting to build..."
for path in src/**/*.csproj; do
dotnet build -f netstandard1.3 -c Release ${path}
dotnet build -f netstandard2.0 -c Release ${path}
dotnet build -f netstandard2.1 -c Release ${path}
done

echo "🤖 Running tests..."
for path in test/*.Tests/*.csproj; do
dotnet test -f netcoreapp2.2 -c Release ${path}
dotnet test -f netcoreapp3.1 -c Release ${path}
dotnet test -f net6.0 -c Release ${path}
done

2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"allowPrerelease": false,
"version": "3.1.100",
"version": "7.0.201",
"rollForward": "latestFeature"
}
}
53 changes: 6 additions & 47 deletions src/Serilog.Sinks.Email/Serilog.Sinks.Email.csproj
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<Description>The email sink for Serilog</Description>
<VersionPrefix>2.4.1</VersionPrefix>
<VersionPrefix>2.5.0</VersionPrefix>
<Authors>Serilog Contributors</Authors>
<TargetFrameworks>net45;net47;netstandard1.3;netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<AssemblyName>Serilog.Sinks.Email</AssemblyName>
<RootNamespace>Serilog</RootNamespace>
Expand All @@ -26,55 +26,14 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Serilog" Version="2.9.0" />
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.3.0" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net45' ">
<Reference Include="System.Net" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net47' ">
<Reference Include="System.Net" />
<Reference Include="System" />
<Reference Include="Microsoft.CSharp" />
</ItemGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'net45' ">
<DefineConstants>$(DefineConstants);SYSTEM_NET</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net47' ">
<DefineConstants>$(DefineConstants);SYSTEM_NET</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<DefineConstants>$(DefineConstants);MAIL_KIT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<DefineConstants>$(DefineConstants);MAIL_KIT</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<DefineConstants>$(DefineConstants);MAIL_KIT</DefineConstants>
</PropertyGroup>
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Sinks.PeriodicBatching" Version="2.3.1" />

<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3' ">
<PackageReference Include="MailKit" Version="2.6.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0' ">
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="MailKit" Version="2.6.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.1' ">
<PackageReference Include="NETStandard.Library" Version="2.0.3" />
<PackageReference Include="MailKit" Version="2.6.0" />
<PackageReference Include="System.Linq" Version="4.3.0" />
<PackageReference Include="System.Threading" Version="4.3.0" />
</ItemGroup>

<ItemGroup>
<None Include="..\..\serilog-sink-nuget.png">
<Pack>True</Pack>
Expand Down
13 changes: 0 additions & 13 deletions src/Serilog.Sinks.Email/Sinks/Email/EmailConnectionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,22 +96,9 @@ public EmailConnectionInfo()
/// </summary>
public bool IsBodyHtml { get; set; }

#if MAIL_KIT
/// <summary>
/// Set secure socket option
/// </summary>
public SecureSocketOptions? SecureSocketOption { get; set; }

#endif

internal virtual IEmailTransport CreateEmailTransport()
{
#if SYSTEM_NET
return new SystemMailEmailTransport(this);
#endif
#if MAIL_KIT
return new MailKitEmailTransport(this);
#endif
}
}
}
80 changes: 0 additions & 80 deletions src/Serilog.Sinks.Email/Sinks/Email/MailKitEmailTransport.cs

This file was deleted.

69 changes: 0 additions & 69 deletions src/Serilog.Sinks.Email/Sinks/Email/SecureSocketOptions.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#if SYSTEM_NET
using System.ComponentModel;
using System.Net.Mail;
using System.Text;
Expand Down Expand Up @@ -97,4 +96,3 @@ static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
}
}
}
#endif
13 changes: 4 additions & 9 deletions test/Serilog.Sinks.Email.Tests/EmailSinkTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using Serilog.Formatting;
using Xunit;

namespace Serilog.Sinks.Email.Tests
Expand Down Expand Up @@ -113,20 +112,16 @@ await emailSink.EmitBatchAsync(new[] {
Assert.Equal("[Error] A multiline" + Environment.NewLine
+ "Message" + Environment.NewLine
+ "System.ArgumentOutOfRangeException: Message of the exception"
#if NEW_ARGUMENTOUTOFRANGEEXCEPTION_MESSAGE

+ " (Parameter 'parameter1')"
#else
+ Environment.NewLine + "Parameter name: parameter1"
#endif

+ Environment.NewLine + "", actual.Body);
Assert.Equal(@"[Error] A multiline" + Environment.NewLine
+ "Message" + Environment.NewLine
+ "System.ArgumentOutOfRangeException: Message of the exception"
#if NEW_ARGUMENTOUTOFRANGEEXCEPTION_MESSAGE

+ " (Parameter 'parameter1')"
#else
+ Environment.NewLine + "Parameter name: parameter1"
#endif

+ Environment.NewLine + "", actual.Subject);
Assert.Equal("[email protected]", actual.From);
Assert.Equal(new[] { "[email protected]" }, actual.To);
Expand Down
Loading