refactor(API): update to use .net8

This commit is contained in:
2025-07-29 14:23:55 +02:00
parent 48724922af
commit 467588429b
5 changed files with 49 additions and 27 deletions

View File

@@ -1,13 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net10.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0-preview.5.25277.114" />
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.18" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.6.2" />
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
@DigitalData.ActiveDirectory.API_HostAddress = http://localhost:5051
@DigitalData.ActiveDirectory.API_HostAddress = http://localhost:5092
GET {{DigitalData.ActiveDirectory.API_HostAddress}}/weatherforecast/
Accept: application/json

View File

@@ -1,15 +1,17 @@
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
// Learn more about configuring OpenAPI at https://aka.ms/aspnet/openapi
builder.Services.AddOpenApi();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
var app = builder.Build();
// Configure the HTTP request pipeline.
if (app.Environment.IsDevelopment())
{
app.MapOpenApi();
app.UseSwagger();
app.UseSwaggerUI();
}
app.UseHttpsRedirection();
@@ -31,7 +33,8 @@ app.MapGet("/weatherforecast", () =>
.ToArray();
return forecast;
})
.WithName("GetWeatherForecast");
.WithName("GetWeatherForecast")
.WithOpenApi();
app.Run();

View File

@@ -1,11 +1,20 @@
{
"$schema": "https://json.schemastore.org/launchsettings.json",
"$schema": "http://json.schemastore.org/launchsettings.json",
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:34411",
"sslPort": 44378
}
},
"profiles": {
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "http://localhost:5051",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "http://localhost:5092",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
@@ -13,8 +22,17 @@
"https": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": false,
"applicationUrl": "https://localhost:7149;http://localhost:5051",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:7221;http://localhost:5092",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"launchUrl": "swagger",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}