Add basic support for .netcore 3.0

This commit is contained in:
Nikolay Kochulin 2019-09-20 20:19:38 +00:00
parent b98440817f
commit 7438e5855a
2 changed files with 10 additions and 6 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web"> <Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp2.1</TargetFramework> <TargetFramework>netcoreapp3.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
@ -10,7 +10,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Dapper" Version="1.60.6" /> <PackageReference Include="Dapper" Version="1.60.6" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" /> <PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.1.2" PrivateAssets="All" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" /> <PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.1.1" />
<PackageReference Include="MySql.Data" Version="8.0.17" /> <PackageReference Include="MySql.Data" Version="8.0.17" />

View File

@ -3,6 +3,7 @@ using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
namespace JetHerald namespace JetHerald
{ {
@ -22,12 +23,12 @@ namespace JetHerald
services.Configure<Options.Telegram>(Configuration.GetSection("Telegram")); services.Configure<Options.Telegram>(Configuration.GetSection("Telegram"));
services.AddSingleton<Db>(); services.AddSingleton<Db>();
services.AddSingleton<JetHeraldBot>(); services.AddSingleton<JetHeraldBot>();
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0);
} }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env) public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{ {
var bot = app.ApplicationServices.GetService<JetHeraldBot>(); var bot = app.ApplicationServices.GetService<JetHeraldBot>();
bot.Init().Wait(); bot.Init().Wait();
@ -36,8 +37,12 @@ namespace JetHerald
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
app.UseMvc(); app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllers();
});
} }
} }
} }