From 6fc93e83c6ac4e17b8d88757833b1b0dc581e1ab Mon Sep 17 00:00:00 2001 From: MysticBoy Date: Wed, 30 Oct 2019 20:00:14 +0800 Subject: [PATCH] upgrade to .net core 3.0 --- ...AspNetCoreSampleQuartzHostedService.csproj | 7 ++--- .../Startup.cs | 11 +++++--- .../SampleQuartzHostedService.csproj | 5 ++-- .../Properties/launchSettings.json | 27 +++++++++++++++++++ .../QuartzHostedService.csproj | 5 ++-- .../QuartzHostedService.Test.csproj | 10 +++---- 6 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 src/QuartzHostedService/Properties/launchSettings.json diff --git a/sample/AspNetCoreSampleQuartzHostedService/AspNetCoreSampleQuartzHostedService.csproj b/sample/AspNetCoreSampleQuartzHostedService/AspNetCoreSampleQuartzHostedService.csproj index 1a248fd..1a91cb6 100644 --- a/sample/AspNetCoreSampleQuartzHostedService/AspNetCoreSampleQuartzHostedService.csproj +++ b/sample/AspNetCoreSampleQuartzHostedService/AspNetCoreSampleQuartzHostedService.csproj @@ -1,13 +1,10 @@ - + - netcoreapp2.2 - InProcess + netcoreapp3.0 - - diff --git a/sample/AspNetCoreSampleQuartzHostedService/Startup.cs b/sample/AspNetCoreSampleQuartzHostedService/Startup.cs index 7105e1e..ecd6ab6 100644 --- a/sample/AspNetCoreSampleQuartzHostedService/Startup.cs +++ b/sample/AspNetCoreSampleQuartzHostedService/Startup.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; using Quartz; @@ -27,7 +28,7 @@ namespace AspNetCoreSampleQuartzHostedService // This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); + services.AddControllersWithViews(); services.AddOptions(); services.Configure(Configuration); services.Configure(options => { options.WriteText = "This is inject string"; }); @@ -39,13 +40,17 @@ namespace AspNetCoreSampleQuartzHostedService } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env, IOptions settings) + public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IOptions settings) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } - app.UseMvc(); + app.UseRouting(); + app.UseEndpoints(endpoint => + { + endpoint.MapControllers(); + }); if (settings.Value.EnableHelloSingleJob) { app.UseQuartzJob(TriggerBuilder.Create().WithSimpleSchedule(x => x.WithIntervalInSeconds(1).RepeatForever())) diff --git a/sample/SampleQuartzHostedService/SampleQuartzHostedService.csproj b/sample/SampleQuartzHostedService/SampleQuartzHostedService.csproj index 93ea6e2..bad6615 100644 --- a/sample/SampleQuartzHostedService/SampleQuartzHostedService.csproj +++ b/sample/SampleQuartzHostedService/SampleQuartzHostedService.csproj @@ -2,12 +2,11 @@ Exe - netcoreapp2.2 - 7.1 + netcoreapp3.0 - + diff --git a/src/QuartzHostedService/Properties/launchSettings.json b/src/QuartzHostedService/Properties/launchSettings.json new file mode 100644 index 0000000..45f479f --- /dev/null +++ b/src/QuartzHostedService/Properties/launchSettings.json @@ -0,0 +1,27 @@ +{ + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:56070/", + "sslPort": 0 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "QuartzHostedService": { + "commandName": "Project", + "launchBrowser": true, + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "applicationUrl": "http://localhost:56071/" + } + } +} \ No newline at end of file diff --git a/src/QuartzHostedService/QuartzHostedService.csproj b/src/QuartzHostedService/QuartzHostedService.csproj index c629c8f..cccce8a 100644 --- a/src/QuartzHostedService/QuartzHostedService.csproj +++ b/src/QuartzHostedService/QuartzHostedService.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.0 mukmyash 0.0.4 @@ -12,8 +12,7 @@ - - + diff --git a/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj b/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj index 180f193..79ed54c 100644 --- a/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj +++ b/test/QuartzHostedService.Test/QuartzHostedService.Test.csproj @@ -1,16 +1,16 @@  - netcoreapp2.0 + netcoreapp3.0 false - - - - + + + + all