Skip to content

Commit

Permalink
Add support for .NET Core 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
augustoproiete committed Oct 16, 2019
1 parent de9e814 commit 0073100
Show file tree
Hide file tree
Showing 14 changed files with 239 additions and 23 deletions.
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"sdk": {
"version": "2.2.401"
"version": "3.0.100"
}
}
10 changes: 10 additions & 0 deletions prism-logging-serilog.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Prism.Logging.Serilog.Tests
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "net45", "net45", "{C8C51579-94E5-400E-914C-3616DBAEBF49}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "netcoreapp3.0", "netcoreapp3.0", "{845167A8-94BF-43C0-B1AD-878B47FDA827}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PrismSerilogWpfDemoNetCoreApp30", "sample\netcoreapp3.0\PrismSerilogWpfDemoNetCoreApp30\PrismSerilogWpfDemoNetCoreApp30.csproj", "{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -35,6 +39,10 @@ Global
{49AF6C05-BB7C-437D-B163-813939457192}.Debug|Any CPU.Build.0 = Debug|Any CPU
{49AF6C05-BB7C-437D-B163-813939457192}.Release|Any CPU.ActiveCfg = Release|Any CPU
{49AF6C05-BB7C-437D-B163-813939457192}.Release|Any CPU.Build.0 = Release|Any CPU
{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -44,6 +52,8 @@ Global
{88146B27-E104-4939-99FD-70557287F877} = {A918D06F-30C4-48CA-8E75-90131BA4B8D8}
{49AF6C05-BB7C-437D-B163-813939457192} = {2CB13D58-3C7B-4AAA-8ADD-F0C3CD52EEE4}
{C8C51579-94E5-400E-914C-3616DBAEBF49} = {2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}
{845167A8-94BF-43C0-B1AD-878B47FDA827} = {2E38532A-A66C-498A-8FBF-4D6FE6F31ECC}
{D16CA8E1-8130-4E9D-8AD2-856F6768DC0C} = {845167A8-94BF-43C0-B1AD-878B47FDA827}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7215B999-A555-49A3-ACCA-ABF01EE7C25B}
Expand Down
1 change: 1 addition & 0 deletions prism-logging-serilog.sln.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleNamedExpression/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ArgumentsStyleStringLiteral/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=CommentTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=ConvertToUsingDeclaration/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=IdentifierTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=LocalizableElement/@EntryIndexedValue">DO_NOT_SHOW</s:String>
<s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=MarkupAttributeTypo/@EntryIndexedValue">DO_NOT_SHOW</s:String>
Expand Down
10 changes: 9 additions & 1 deletion sample/net45/PrismSerilogWpfDemoNet45/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="Prism" publicKeyToken="40ee6c3a2184dc59" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-7.2.0.1367" newVersion="7.2.0.1367" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@
<Reference Include="CommonServiceLocator, Version=2.0.4.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\CommonServiceLocator.2.0.4\lib\net45\CommonServiceLocator.dll</HintPath>
</Reference>
<Reference Include="Prism, Version=7.1.0.431, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Core.7.1.0.431\lib\net45\Prism.dll</HintPath>
<Reference Include="Prism, Version=7.2.0.1367, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Core.7.2.0.1367\lib\net45\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.Unity.Wpf, Version=7.1.0.431, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Unity.7.1.0.431\lib\net45\Prism.Unity.Wpf.dll</HintPath>
<Reference Include="Prism.Unity.Wpf, Version=7.2.0.1367, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Unity.7.2.0.1367\lib\net45\Prism.Unity.Wpf.dll</HintPath>
</Reference>
<Reference Include="Prism.Wpf, Version=7.1.0.431, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Wpf.7.1.0.431\lib\net45\Prism.Wpf.dll</HintPath>
<Reference Include="Prism.Wpf, Version=7.2.0.1367, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Wpf.7.2.0.1367\lib\net45\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="Serilog, Version=2.0.0.0, Culture=neutral, PublicKeyToken=24c2f752a8e58a10, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Serilog.2.8.0\lib\net45\Serilog.dll</HintPath>
Expand All @@ -56,17 +56,23 @@
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.Runtime.CompilerServices.Unsafe.4.5.2\lib\netstandard1.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\System.ValueTuple.4.5.0\lib\netstandard1.0\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Prism.Wpf.7.1.0.431\lib\net45\System.Windows.Interactivity.dll</HintPath>
<HintPath>..\..\..\packages\Prism.Wpf.7.2.0.1367\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Unity.Abstractions, Version=3.3.1.0, Culture=neutral, PublicKeyToken=6d32ff45e0ccc69f, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Unity.Abstractions.3.3.1\lib\net45\Unity.Abstractions.dll</HintPath>
<Reference Include="Unity.Abstractions, Version=4.1.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Unity.Abstractions.4.1.3\lib\net45\Unity.Abstractions.dll</HintPath>
</Reference>
<Reference Include="Unity.Container, Version=5.8.11.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Unity.Container.5.8.11\lib\net45\Unity.Container.dll</HintPath>
<Reference Include="Unity.Container, Version=5.10.3.0, Culture=neutral, PublicKeyToken=489b6accfaf20ef0, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Unity.Container.5.10.3\lib\net45\Unity.Container.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
Expand Down
12 changes: 7 additions & 5 deletions sample/net45/PrismSerilogWpfDemoNet45/packages.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CommonServiceLocator" version="2.0.4" targetFramework="net45" />
<package id="Prism.Core" version="7.1.0.431" targetFramework="net45" />
<package id="Prism.Unity" version="7.1.0.431" targetFramework="net45" />
<package id="Prism.Wpf" version="7.1.0.431" targetFramework="net45" />
<package id="Prism.Core" version="7.2.0.1367" targetFramework="net45" />
<package id="Prism.Unity" version="7.2.0.1367" targetFramework="net45" />
<package id="Prism.Wpf" version="7.2.0.1367" targetFramework="net45" />
<package id="Serilog" version="2.8.0" targetFramework="net45" />
<package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net45" />
<package id="Unity.Abstractions" version="3.3.1" targetFramework="net45" />
<package id="Unity.Container" version="5.8.11" targetFramework="net45" />
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net45" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net45" />
<package id="Unity.Abstractions" version="4.1.3" targetFramework="net45" />
<package id="Unity.Container" version="5.10.3" targetFramework="net45" />
</packages>
9 changes: 9 additions & 0 deletions sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<prism:PrismApplication x:Class="PrismSerilogWpfDemoNetCoreApp30.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://prismlibrary.com/"
xmlns:local="clr-namespace:PrismSerilogWpfDemoNetCoreApp30">
<Application.Resources>

</Application.Resources>
</prism:PrismApplication>
38 changes: 38 additions & 0 deletions sample/netcoreapp3.0/PrismSerilogWpfDemoNetCoreApp30/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
using System.Text;
using System.Windows;
using Prism.Ioc;
using Serilog;
using PrismSerilogWpfDemoNetCoreApp30.Views;

namespace PrismSerilogWpfDemoNetCoreApp30
{
public partial class App
{
protected override void OnStartup(StartupEventArgs e)
{
Log.Logger = new LoggerConfiguration()
.MinimumLevel.Debug()
.WriteTo.File(path: "DemoLog.txt", encoding: Encoding.UTF8)
.CreateLogger();

base.OnStartup(e);
}

protected override void OnExit(ExitEventArgs e)
{
Log.CloseAndFlush();

base.OnExit(e);
}

protected override void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSerilog();
}

protected override Window CreateShell()
{
return Container.Resolve<MainWindow>();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.0</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\src\Prism.Logging.Serilog\Prism.Logging.Serilog.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Prism.Unity" Version="7.2.0.1367" />

<PackageReference Include="Serilog" Version="2.8.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using System;
using System.IO;
using System.Text;
using Prism.Commands;
using Prism.Logging;
using Prism.Mvvm;

namespace PrismSerilogWpfDemoNetCoreApp30.ViewModels
{
public class MainWindowViewModel : BindableBase
{
private readonly ILoggerFacade _logger;
private string _title = "Prism Serilog WPF Demo (.NET Core 3.0)";

public MainWindowViewModel(ILoggerFacade logger)
{
_logger = logger ?? throw new ArgumentNullException(nameof(logger));

LogDebugCommand = new DelegateCommand(LogDebug);
LogInformationCommand = new DelegateCommand(LogInformation);
LogWarningCommand = new DelegateCommand(LogWarning);
LogExceptionCommand = new DelegateCommand(LogException);
}

public string Title
{
get => _title;
set => SetProperty(ref _title, value);
}

public string Text
{
get
{
const string logFileName = "DemoLog.txt";

if (!File.Exists(logFileName))
{
return null;
}

// FileShare.ReadWrite required for Serilog to continue writing - File.ReadAllText doesn't allow that
using (var stream = new FileStream(logFileName, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (var reader = new StreamReader(stream, Encoding.UTF8, detectEncodingFromByteOrderMarks: true))
{
return reader.ReadToEnd();
}
}
}
}

public DelegateCommand LogDebugCommand { get; }
public DelegateCommand LogInformationCommand { get; }
public DelegateCommand LogWarningCommand { get; }
public DelegateCommand LogExceptionCommand { get; }

private void LogDebug()
{
_logger.Log("This is a Debug message!", Category.Debug, Priority.High);

RaisePropertyChanged(nameof(Text));
}

private void LogInformation()
{
_logger.Log("This is an Information message!", Category.Info, Priority.High);

RaisePropertyChanged(nameof(Text));
}

private void LogWarning()
{
_logger.Log("This is an Warning message!", Category.Warn, Priority.High);

RaisePropertyChanged(nameof(Text));
}

private void LogException()
{
_logger.Log("This is an Exception message!", Category.Exception, Priority.High);

RaisePropertyChanged(nameof(Text));
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Window x:Class="PrismSerilogWpfDemoNetCoreApp30.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PrismSerilogWpfDemoNetCoreApp30"
mc:Ignorable="d"
Title="{Binding Title}" Height="490" Width="480"
WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow">
<Grid Margin="0 10 0 0">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Top">
<TextBlock TextWrapping="Wrap" FontSize="14" Margin="0 0 0 10">Log messages are being written to `DemoLog.txt`</TextBlock>
<TextBox Height="330" Width="440" Margin="5 0 0 0" Padding="5" Text="{Binding Text, Mode=OneWay}" VerticalScrollBarVisibility="Visible" IsReadOnly="True" />
</StackPanel>
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Bottom" Orientation="Horizontal">
<Button Margin="10 0 0 30" Padding="5" Command="{Binding LogDebugCommand}" Content="Log Debug" />
<Button Margin="10 0 0 30" Padding="5" Command="{Binding LogInformationCommand}" Content="Log Information" />
<Button Margin="10 0 0 30" Padding="5" Command="{Binding LogWarningCommand}" Content="Log Warning" />
<Button Margin="10 0 0 30" Padding="5" Command="{Binding LogExceptionCommand}" Content="Log Exception" />
</StackPanel>
</Grid>
</Window>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Windows;

namespace PrismSerilogWpfDemoNetCoreApp30.Views
{
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
8 changes: 4 additions & 4 deletions src/Prism.Logging.Serilog/Prism.Logging.Serilog.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

<PropertyGroup>
<Description>Integrate Serilog with Prism in your WPF, UWP, or Xamarin Forms apps.</Description>
<VersionPrefix>7.1.0.431</VersionPrefix>
<VersionPrefix>7.2.0.1367</VersionPrefix>
<Authors>Caio Proiete and Contributors</Authors>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
<TargetFrameworks>net45;netcoreapp3.0</TargetFrameworks>
<AssemblyName>Prism.Logging.Serilog</AssemblyName>
<AssemblyOriginatorKeyFile>../../assets/prism.snk</AssemblyOriginatorKeyFile>
<SignAssembly>true</SignAssembly>
Expand All @@ -22,15 +22,15 @@
<GenerateAssemblyFileVersionAttribute>true</GenerateAssemblyFileVersionAttribute>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!-- Don't reference the full NETStandard.Library -->
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' != 'netstandard2.0' ">true</DisableImplicitFrameworkReferences>
<DisableImplicitFrameworkReferences Condition=" '$(TargetFramework)' == 'net45' ">true</DisableImplicitFrameworkReferences>
<NoWarn>$(NoWarn);NU5048</NoWarn>
<TreatWarningsAsErrors>True</TreatWarningsAsErrors>
<TreatSpecificWarningsAsErrors />
<RootNamespace>Prism</RootNamespace>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Prism.Core" Version="7.1.0.431" />
<PackageReference Include="Prism.Core" Version="7.2.0.1367" />
<PackageReference Include="Serilog" Version="2.8.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp2.0</TargetFrameworks>
<TargetFrameworks>netcoreapp3.0</TargetFrameworks>
<AssemblyName>Prism.Logging.Serilog.Tests</AssemblyName>
<PackageId>Prism.Logging.Serilog.Tests</PackageId>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
Expand Down

0 comments on commit 0073100

Please sign in to comment.