Upgrade to .net5 rc1 and fix all breaking changes in the web api since .net core 2.2
This commit is contained in:
parent
482a74839a
commit
b743539c74
6 changed files with 27 additions and 29 deletions
|
@ -10,7 +10,7 @@ variables:
|
|||
|
||||
Build:
|
||||
stage: build
|
||||
image: mcr.microsoft.com/dotnet/core/sdk:5.0-focal
|
||||
image: mcr.microsoft.com/dotnet/sdk:5.0
|
||||
artifacts:
|
||||
expire_in: 1h
|
||||
paths:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
FROM mcr.microsoft.com/dotnet/core/aspnet:5.0-focal
|
||||
FROM mcr.microsoft.com/dotnet/aspnet:5.0
|
||||
|
||||
COPY ./app /app/
|
||||
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||
<PackageReference Include="Discord.Net" Version="2.2.0" />
|
||||
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.45.0.1929" />
|
||||
<PackageReference Include="HtmlAgilityPack" Version="1.11.24" />
|
||||
<PackageReference Include="MtgApiManager.Lib" Version="1.2.2" />
|
||||
|
|
|
@ -13,19 +13,19 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="CommandLineParser" Version="2.8.0" />
|
||||
<PackageReference Include="Discord.Net" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0-preview.8.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Options" Version="5.0.0-rc.1.*" />
|
||||
<PackageReference Include="MyAnimeListSharp" Version="1.3.4" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="NLog" Version="4.7.2" />
|
||||
<PackageReference Include="NLog.Config" Version="4.7.2" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.0-preview8" />
|
||||
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="5.0.0-rc1" />
|
||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||
<PackageReference Include="SumoLogic.Logging.NLog" Version="1.0.1.3" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
|
@ -10,15 +10,6 @@
|
|||
<NoWarn>NU1701</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Hosting" Version="2.2.7" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.Cors" Version="2.2.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
|
||||
<PackageReference Include="System.Net.Http" Version="4.3.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Core\Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
|
|
@ -18,6 +18,9 @@ namespace Geekbot.Web
|
|||
{
|
||||
public static class WebApiStartup
|
||||
{
|
||||
// Using the "Microsoft.NET.Sdk.Web" SDK requires a static main function...
|
||||
public static void Main() {}
|
||||
|
||||
public static void StartWebApi(IGeekbotLogger logger, RunParameters runParameters, CommandService commandService,
|
||||
DatabaseContext databaseContext, DiscordSocketClient client, IGlobalSettings globalSettings, IHighscoreManager highscoreManager)
|
||||
{
|
||||
|
@ -28,22 +31,27 @@ namespace Geekbot.Web
|
|||
})
|
||||
.ConfigureServices(services =>
|
||||
{
|
||||
services.AddMvc();
|
||||
services.AddSingleton(commandService);
|
||||
services.AddSingleton(databaseContext);
|
||||
services.AddSingleton(client);
|
||||
services.AddSingleton(globalSettings);
|
||||
services.AddSingleton(highscoreManager);
|
||||
services.AddControllers();
|
||||
services.AddCors(options =>
|
||||
{
|
||||
options.AddPolicy("AllowSpecificOrigin",
|
||||
builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod());
|
||||
});
|
||||
|
||||
services.AddSingleton(commandService);
|
||||
services.AddSingleton(databaseContext);
|
||||
services.AddSingleton(client);
|
||||
services.AddSingleton(globalSettings);
|
||||
services.AddSingleton(highscoreManager);
|
||||
})
|
||||
.Configure(app =>
|
||||
{
|
||||
app.UseMvc();
|
||||
app.UseRouting();
|
||||
app.UseCors(builder => builder.AllowAnyOrigin().AllowAnyHeader().AllowAnyMethod().Build());
|
||||
app.UseEndpoints(endpoints =>
|
||||
{
|
||||
endpoints.MapControllers();
|
||||
});
|
||||
})
|
||||
.ConfigureLogging(logging =>
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue