File tree Expand file tree Collapse file tree 5 files changed +35
-21
lines changed
src/Serilog.Sinks.EventLog
test/Serilog.Sinks.EventLog.Tests Expand file tree Collapse file tree 5 files changed +35
-21
lines changed Original file line number Diff line number Diff line change 11version : ' {build}'
22skip_tags : true
3- image : Visual Studio 2015
3+ image : Visual Studio 2017
44configuration : Release
55install :
6- - ps : mkdir -Force ".\build\" | Out-Null
7- - ps : Invoke-WebRequest "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.ps1" -OutFile ".\build\installcli.ps1"
8- - ps : $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetcli"
9- - ps : ' & .\build\installcli.ps1 -InstallDir "$env:DOTNET_INSTALL_DIR" -NoPath -Version 1.0.1'
10- - ps : $env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
6+ - ps : mkdir -Force ".\build\" | Out-Null
117build_script :
128- ps : ./Build.ps1
139test : off
@@ -27,4 +23,3 @@ deploy:
2723 tag : v$(appveyor_build_version)
2824 on :
2925 branch : master
30-
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFramework >net452</ TargetFramework >
4+ <TargetFrameworks >net452;net461;netcoreapp2.0;</ TargetFrameworks >
55 <AssemblyName >Sample</AssemblyName >
66 <OutputType >Exe</OutputType >
77 <PackageId >Sample</PackageId >
1919 <Reference Include =" System" />
2020 <Reference Include =" Microsoft.CSharp" />
2121 </ItemGroup >
22-
2322</Project >
Original file line number Diff line number Diff line change 1919using Serilog . Sinks . EventLog ;
2020using Serilog . Formatting ;
2121
22+ #if NETSTANDARD2_0
23+ using System . Runtime . InteropServices ;
24+ #endif
25+
2226namespace Serilog
2327{
2428 /// <summary>
@@ -53,8 +57,19 @@ public static LoggerConfiguration EventLog(
5357 LogEventLevel restrictedToMinimumLevel = LevelAlias . Minimum ,
5458 IEventIdProvider eventIdProvider = null )
5559 {
56- if ( loggerConfiguration == null ) throw new ArgumentNullException ( nameof ( loggerConfiguration ) ) ;
60+ if ( loggerConfiguration == null )
61+ {
62+ throw new ArgumentNullException ( nameof ( loggerConfiguration ) ) ;
63+ }
5764
65+
66+ #if NETSTANDARD2_0
67+ // Verify the code is running on Windows.
68+ if ( ! RuntimeInformation . IsOSPlatform ( OSPlatform . Windows ) )
69+ {
70+ throw new PlatformNotSupportedException ( RuntimeInformation . OSDescription ) ;
71+ }
72+ #endif
5873 var formatter = new MessageTemplateTextFormatter ( outputTemplate , formatProvider ) ;
5974
6075 if ( eventIdProvider == null )
Original file line number Diff line number Diff line change 77 <NeutralLanguage >en-US</NeutralLanguage >
88 <VersionPrefix >3.1.0</VersionPrefix >
99 <Authors >Jeremy Clarke;Fabian Wetzel</Authors >
10- <TargetFramework >net45</ TargetFramework >
10+ <TargetFrameworks >net45;netstandard2.0;</ TargetFrameworks >
1111 <TreatWarningsAsErrors >true</TreatWarningsAsErrors >
1212 <GenerateDocumentationFile >true</GenerateDocumentationFile >
1313 <AssemblyName >Serilog.Sinks.EventLog</AssemblyName >
2828 <PackageReference Include =" Serilog" Version =" 2.3.0" />
2929 </ItemGroup >
3030
31+ <ItemGroup Condition =" '$(TargetFramework)' == 'netstandard2.0'" >
32+ <PackageReference Include =" System.Diagnostics.EventLog" >
33+ <Version >4.5.0-preview1-25914-04</Version >
34+ </PackageReference >
35+ </ItemGroup >
36+
3137 <ItemGroup Condition =" '$(TargetFramework)' == 'net45' " >
3238 <Reference Include =" System" />
3339 <Reference Include =" Microsoft.CSharp" />
3440 </ItemGroup >
35-
3641</Project >
Original file line number Diff line number Diff line change 11<Project Sdk =" Microsoft.NET.Sdk" >
22
33 <PropertyGroup >
4- <TargetFramework >net451</ TargetFramework >
4+ <TargetFrameworks >net451;net461;netcoreapp2.0;</ TargetFrameworks >
55 <AssemblyName >Serilog.Sinks.EventLog.Tests</AssemblyName >
66 <AssemblyOriginatorKeyFile >../../assets/Serilog.snk</AssemblyOriginatorKeyFile >
77 <SignAssembly >true</SignAssembly >
2121 </ItemGroup >
2222
2323 <ItemGroup >
24- <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.0 .0" />
25- <PackageReference Include =" NUnit3TestAdapter" Version =" 3.8.0-alpha1 " />
24+ <PackageReference Include =" Microsoft.NET.Test.Sdk" Version =" 15.5 .0" />
25+ <PackageReference Include =" NUnit3TestAdapter" Version =" 3.9.0 " />
2626 <PackageReference Include =" Serilog" Version =" 2.3.0" />
2727 <PackageReference Include =" Serilog.Settings.Configuration" Version =" 2.3.1" />
2828 <PackageReference Include =" Microsoft.Extensions.Configuration.Xml" Version =" 1.0.0" />
2929 <PackageReference Include =" Newtonsoft.Json" Version =" 9.0.1" />
30- <PackageReference Include =" NUnit" Version =" 3.5.0" />
31- </ItemGroup >
32-
33- <ItemGroup Condition =" '$(TargetFramework)' == 'net451' " >
34- <Reference Include =" System" />
35- <Reference Include =" Microsoft.CSharp" />
30+ <PackageReference Include =" NUnit" Version =" 3.9.0" />
3631 </ItemGroup >
3732
3833 <ItemGroup >
3934 <Service Include =" {82a7f48d-3b50-4b1e-b82e-3ada8210c358}" />
4035 </ItemGroup >
4136
37+ <ItemGroup Condition =" '$(TargetFramework)' == 'net451' " >
38+ <Reference Include =" System" />
39+ <Reference Include =" Microsoft.CSharp" />
40+ </ItemGroup >
41+
4242</Project >
You can’t perform that action at this time.
0 commit comments