From 6073a8dd6061a2a79710d59ecb3f17620cf7c47a Mon Sep 17 00:00:00 2001 From: Blake Niemyjski Date: Fri, 25 Jan 2019 09:08:18 -0600 Subject: [PATCH] Updated samples to .net core 2.2 --- Exceptionless.Net.sln.DotSettings | 1 + build/common.props | 2 +- .../Exceptionless.SampleAspNetCore.csproj | 5 ++--- samples/Exceptionless.SampleAspNetCore/Program.cs | 13 +++++-------- samples/Exceptionless.SampleAspNetCore/Startup.cs | 10 ++++++---- samples/Exceptionless.SampleAspNetCore/web.config | 6 ++++-- .../Exceptionless.SampleConsole.csproj | 3 +-- .../ExceptionlessLoggerExtensions.cs | 2 ++ 8 files changed, 22 insertions(+), 20 deletions(-) diff --git a/Exceptionless.Net.sln.DotSettings b/Exceptionless.Net.sln.DotSettings index 29a6ec0d..8ceda8ff 100644 --- a/Exceptionless.Net.sln.DotSettings +++ b/Exceptionless.Net.sln.DotSettings @@ -546,6 +546,7 @@ True True True + True True True True diff --git a/build/common.props b/build/common.props index b7da77c9..c51e0845 100644 --- a/build/common.props +++ b/build/common.props @@ -28,7 +28,7 @@ Exceptionless Exceptionless is a cloud based error reporting service that sends your exceptions to https://exceptionless.com and provides aggregated views and analytics. - Copyright (c) 2018 Exceptionless. All rights reserved. + Copyright (c) 2019 Exceptionless. All rights reserved. Exceptionless true $(SolutionDir)artifacts diff --git a/samples/Exceptionless.SampleAspNetCore/Exceptionless.SampleAspNetCore.csproj b/samples/Exceptionless.SampleAspNetCore/Exceptionless.SampleAspNetCore.csproj index 8f2d1396..efd87fb5 100644 --- a/samples/Exceptionless.SampleAspNetCore/Exceptionless.SampleAspNetCore.csproj +++ b/samples/Exceptionless.SampleAspNetCore/Exceptionless.SampleAspNetCore.csproj @@ -1,13 +1,12 @@  - netcoreapp2.0 + netcoreapp2.2 portable true Exceptionless.SampleAspNetCore Exe Exceptionless.SampleAspNetCore - 2.0.0 $(DefineConstants);NETSTANDARD;NETSTANDARD2_0 @@ -18,6 +17,6 @@ - + \ No newline at end of file diff --git a/samples/Exceptionless.SampleAspNetCore/Program.cs b/samples/Exceptionless.SampleAspNetCore/Program.cs index 224b68de..deaa8127 100644 --- a/samples/Exceptionless.SampleAspNetCore/Program.cs +++ b/samples/Exceptionless.SampleAspNetCore/Program.cs @@ -1,18 +1,15 @@ using System; -using System.IO; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; namespace Exceptionless.SampleAspNetCore { public class Program { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseIISIntegration() - .UseStartup() - .Build(); + CreateWebHostBuilder(args).Build().Run(); + } - host.Run(); + public static IWebHostBuilder CreateWebHostBuilder(string[] args) { + return WebHost.CreateDefaultBuilder(args).UseStartup(); } } } \ No newline at end of file diff --git a/samples/Exceptionless.SampleAspNetCore/Startup.cs b/samples/Exceptionless.SampleAspNetCore/Startup.cs index 7eebd551..6d141af9 100644 --- a/samples/Exceptionless.SampleAspNetCore/Startup.cs +++ b/samples/Exceptionless.SampleAspNetCore/Startup.cs @@ -1,6 +1,7 @@ using System; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Logging; @@ -18,7 +19,11 @@ public Startup(IHostingEnvironment env) { public IConfigurationRoot Configuration { get; } public void ConfigureServices(IServiceCollection services) { - services.AddMvc(); + services.AddLogging(b => b + .AddConfiguration(Configuration.GetSection("Logging")) + .AddDebug() + .AddConsole()); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); } public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { @@ -33,9 +38,6 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF //loggerFactory.AddExceptionless((c) => c.ReadFromConfiguration(Configuration)); loggerFactory.AddExceptionless(); - loggerFactory.AddConsole(Configuration.GetSection("Logging")); - loggerFactory.AddDebug(); - app.UseMvc(); } } diff --git a/samples/Exceptionless.SampleAspNetCore/web.config b/samples/Exceptionless.SampleAspNetCore/web.config index 6dafb7fe..b38d08fb 100644 --- a/samples/Exceptionless.SampleAspNetCore/web.config +++ b/samples/Exceptionless.SampleAspNetCore/web.config @@ -2,8 +2,10 @@ - + - + + + \ No newline at end of file diff --git a/samples/Exceptionless.SampleConsole/Exceptionless.SampleConsole.csproj b/samples/Exceptionless.SampleConsole/Exceptionless.SampleConsole.csproj index 99ab10a6..9e8ac5ee 100644 --- a/samples/Exceptionless.SampleConsole/Exceptionless.SampleConsole.csproj +++ b/samples/Exceptionless.SampleConsole/Exceptionless.SampleConsole.csproj @@ -1,10 +1,9 @@  - netcoreapp2.0 + netcoreapp2.2 Exceptionless.SampleConsole Exe - 2.0.0 diff --git a/src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerExtensions.cs b/src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerExtensions.cs index 76f099df..3cb21ff1 100644 --- a/src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerExtensions.cs +++ b/src/Platforms/Exceptionless.Extensions.Logging/ExceptionlessLoggerExtensions.cs @@ -24,6 +24,8 @@ public static ExceptionlessLogLevel ToLogLevel(this LogLevel level) { return ExceptionlessLogLevel.Off; } + // TODO: Add support for ILoggingBuilder + /// /// Adds Exceptionless to the logging pipeline using the default client. ///