diff --git a/NuGet.config b/NuGet.config index e90b941..7bab347 100644 --- a/NuGet.config +++ b/NuGet.config @@ -2,6 +2,7 @@ + diff --git a/src/DotNetClub.Core/DotNetClub.Core.csproj b/src/DotNetClub.Core/DotNetClub.Core.csproj index 6a3fb39..86ab7fd 100644 --- a/src/DotNetClub.Core/DotNetClub.Core.csproj +++ b/src/DotNetClub.Core/DotNetClub.Core.csproj @@ -1,11 +1,9 @@  - netstandard1.6 + netstandard2.0 DotNetClub.Core DotNetClub.Core - 1.6.1 - $(PackageTargetFallback);dnxcore50 false false false @@ -16,14 +14,14 @@ - - - - - - - - + + + + + + + + diff --git a/src/DotNetClub.Data.EntityFramework/DotNetClub.Data.EntityFramework.csproj b/src/DotNetClub.Data.EntityFramework/DotNetClub.Data.EntityFramework.csproj index 7fe93df..9a82651 100644 --- a/src/DotNetClub.Data.EntityFramework/DotNetClub.Data.EntityFramework.csproj +++ b/src/DotNetClub.Data.EntityFramework/DotNetClub.Data.EntityFramework.csproj @@ -1,11 +1,9 @@  - netstandard1.6 + netstandard2.0 DotNetClub.Data.EntityFramework DotNetClub.Data.EntityFramework - 1.6.1-* - $(PackageTargetFallback);dnxcore50 false false false @@ -16,9 +14,9 @@ - - - + + + diff --git a/src/DotNetClub.Domain/DotNetClub.Domain.csproj b/src/DotNetClub.Domain/DotNetClub.Domain.csproj index 31772af..dc0ed57 100644 --- a/src/DotNetClub.Domain/DotNetClub.Domain.csproj +++ b/src/DotNetClub.Domain/DotNetClub.Domain.csproj @@ -1,18 +1,16 @@  - netstandard1.6 + netstandard2.0 DotNetClub.Domain DotNetClub.Domain - 1.6.1 - $(PackageTargetFallback);dnxcore50 false false false - + diff --git a/src/DotNetClub.Web/DotNetClub.Web.csproj b/src/DotNetClub.Web/DotNetClub.Web.csproj index a8aec50..f869c16 100644 --- a/src/DotNetClub.Web/DotNetClub.Web.csproj +++ b/src/DotNetClub.Web/DotNetClub.Web.csproj @@ -1,14 +1,11 @@  - netcoreapp1.0 + netcoreapp2.0 true DotNetClub.Web - Exe DotNetClub.Web aspnet-DotNetClub.Web-74a27842-2b1e-4e2e-8f35-7fee0c6f274f - 1.1.1 - $(PackageTargetFallback);dotnet5.6;portable-net45+win8 @@ -23,21 +20,13 @@ - - - - - - - - All - - - - - - - + + + + + + + @@ -48,8 +37,9 @@ - - + + + diff --git a/src/DotNetClub.Web/Program.cs b/src/DotNetClub.Web/Program.cs index 6c6ba1e..03f22a9 100644 --- a/src/DotNetClub.Web/Program.cs +++ b/src/DotNetClub.Web/Program.cs @@ -3,8 +3,11 @@ using System.IO; using System.Linq; using System.Threading.Tasks; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Shared.Infrastructure; +using Microsoft.AspNetCore.Builder; +using NLog.Web; +using Autofac.Extensions.DependencyInjection; namespace DotNetClub.Web { @@ -12,15 +15,25 @@ public class Program { public static void Main(string[] args) { - var host = new WebHostBuilder() - .UseKestrel() - .UseContentRoot(Directory.GetCurrentDirectory()) - .UseInfrastructureFactory() - .UseIISIntegration() + // NLog: setup the logger first to catch all errors + var logger = NLogBuilder.ConfigureNLog("NLog.config").GetCurrentClassLogger(); + try + { + logger.Debug("init main"); + BuildWebHost(args).Run(); + } + catch (Exception e) + { + //NLog: catch setup errors + logger.Error(e, "Stopped program because of exception"); + throw; + } + } + public static IWebHost BuildWebHost(string[] args) => + WebHost.CreateDefaultBuilder(args) + .ConfigureServices(services => services.AddAutofac()) .UseStartup() + .UseNLog() // NLog: setup NLog for Dependency injection .Build(); - - host.Run(); - } } } diff --git a/src/DotNetClub.Web/Startup.cs b/src/DotNetClub.Web/Startup.cs index f1e6b21..dbfc8fe 100644 --- a/src/DotNetClub.Web/Startup.cs +++ b/src/DotNetClub.Web/Startup.cs @@ -19,16 +19,11 @@ namespace DotNetClub.Web { public class Startup { - public IConfigurationRoot Configuration { get; private set; } + public IConfiguration Configuration { get; private set; } - public Startup(IHostingEnvironment env) + public Startup(IConfiguration configuration) { - var builder = new ConfigurationBuilder() - .AddEnvironmentVariables() - .AddJsonFile("appsettings.json", optional: true) - .AddUserSecrets(); - - Configuration = builder.Build(); + Configuration = configuration; } // This method gets called by the runtime. Use this method to add services to the container. @@ -69,9 +64,6 @@ public void ConfigureContainer(ContainerBuilder builder) // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory) { - loggerFactory.AddNLog(); - loggerFactory.ConfigureNLog(System.IO.Path.Combine(env.ContentRootPath, "nlog.config")); - if (env.IsDevelopment()) { app.UseDeveloperExceptionPage();