Skip to content

Commit ef21335

Browse files
committed
#升级到.netcore3.1#
1 parent 6e4712b commit ef21335

File tree

3 files changed

+19
-23
lines changed

3 files changed

+19
-23
lines changed

APIJSON.NET/APIJSON.NET/APIJSON.NET.csproj

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>netcoreapp2.2</TargetFramework>
4+
<TargetFramework>netcoreapp3.1</TargetFramework>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -19,18 +19,15 @@
1919
</ItemGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="AspectCore.Extensions.Reflection" Version="1.2.0" />
23-
<PackageReference Include="Microsoft.AspNetCore.App" />
24-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="2.2.0" />
22+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="3.1.4" />
2523
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
2624
<PackageReference Include="Microsoft.AspNetCore.Rewrite" Version="2.2.0" />
2725
<PackageReference Include="Microsoft.AspNetCore.Server.Kestrel.Https" Version="2.2.0" />
28-
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.2.3" />
29-
<PackageReference Include="MySql.Data" Version="8.0.15" />
30-
<PackageReference Include="Oracle.ManagedDataAccess.Core" Version="2.18.6" />
31-
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
32-
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="4.0.1" />
33-
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="4.0.1" />
26+
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="3.1.3" />
27+
28+
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.4.1" />
29+
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="5.4.1" />
30+
<PackageReference Include="Swashbuckle.AspNetCore.Swagger" Version="5.4.1" />
3431
</ItemGroup>
3532

3633
<ItemGroup>

APIJSON.NET/APIJSON.NET/Startup.cs

+9-10
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Microsoft.Extensions.Configuration;
1313
using Microsoft.Extensions.DependencyInjection;
1414
using Microsoft.IdentityModel.Tokens;
15+
using Microsoft.OpenApi.Models;
1516
using Swashbuckle.AspNetCore.Swagger;
1617

1718
public class Startup
@@ -46,10 +47,10 @@ public void ConfigureServices(IServiceCollection services)
4647
.AllowAnyHeader()
4748
.AllowAnyMethod().AllowCredentials()
4849
));
49-
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);
50+
services.AddControllers();
5051
services.AddSwaggerGen(c =>
5152
{
52-
c.SwaggerDoc("v1", new Info { Title = "APIJSON.NET", Version = "v1" });
53+
c.SwaggerDoc("v1", new OpenApiInfo { Title = "APIJSON.NET", Version = "v1" });
5354
});
5455
services.AddSingleton<DbContext>();
5556
services.AddSingleton<SelectTable>();
@@ -61,17 +62,12 @@ public void ConfigureServices(IServiceCollection services)
6162
}
6263

6364
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
64-
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
65+
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
6566
{
6667

6768
app.UseAuthentication();
6869

69-
app.UseMvc(routes =>
70-
{
71-
routes.MapRoute(
72-
name: "default",
73-
template: "{controller=Home}/{action=Index}/{id?}");
74-
});
70+
app.UseRouting();
7571
app.UseStaticFiles();
7672
app.UseCors(_defaultCorsPolicyName);
7773
app.UseSwagger();
@@ -80,7 +76,10 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
8076
c.SwaggerEndpoint("/swagger/v1/swagger.json", "My API V1");
8177

8278
});
83-
79+
app.UseEndpoints(endpoints =>
80+
{
81+
endpoints.MapControllers();
82+
});
8483
app.UseJwtTokenMiddleware();
8584
DbInit.Initialize(app);
8685
}

APIJSON.NET/APIJSONCommon/ApiJson.Common.csproj

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
</ItemGroup>
1313

1414
<ItemGroup>
15-
<PackageReference Include="AspectCore.Extensions.Reflection" Version="1.1.0" />
16-
<PackageReference Include="Microsoft.Extensions.Options" Version="2.1.1" />
17-
<PackageReference Include="sqlSugarCore" Version="4.9.9.10" />
15+
<PackageReference Include="AspectCore.Extensions.Reflection" Version="2.1.0" />
16+
<PackageReference Include="Microsoft.Extensions.Options" Version="3.1.4" />
17+
<PackageReference Include="sqlSugarCore" Version="5.0.0.15" />
1818
</ItemGroup>
1919

2020
</Project>

0 commit comments

Comments
 (0)