Skip to content

Commit

Permalink
Upgraded to .NET 9
Browse files Browse the repository at this point in the history
  • Loading branch information
vivet committed Dec 10, 2024
1 parent e25d2cb commit c6d26b3
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 28 deletions.
4 changes: 2 additions & 2 deletions Api/.github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ env:
IMAGE_NAME: nano.template.api
SERVICE_NAME: nano-template-api
VERSION: '${{ vars.VERSION }}.${{ github.run_number }}.${{ github.run_attempt }}'
DOTNET_SDK_VERSION: 8.0-jammy
DOTNET_ASPNET_VERSION: 8.0-jammy
DOTNET_SDK_VERSION: 9.0-noble
DOTNET_ASPNET_VERSION: 9.0-noble
ASPNETCORE_ENVIRONMENT: ${{ github.ref == 'refs/heads/master' && 'Production' || 'Staging' }}
AZURE_GROUP: Kubernetes
AZURE_LOCATION: North Europe
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<WarningsAsErrors />
<NoWarn></NoWarn>
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
Expand All @@ -10,10 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="Moq" Version="4.18.4" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup>

<ItemGroup>
Expand Down
29 changes: 29 additions & 0 deletions Api/Nano.Template.Api/Controllers/SamplesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,19 @@
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using Nano.App.Api.Requests;
using Nano.Models;
using Nano.Models.Const;
using Nano.Security.Extensions;
using Nano.Template.Api.Controllers.Requests.Samples;
using Nano.Template.Api.Controllers.Responses.Samples;
using Nano.Template.Service.Models.Api;
using Nano.Template.Service.Models.Criterias;
using Nano.Template.Service.Models.Data;
using Nano.Web.Attributes;
using Nano.Web.Controllers;

namespace Nano.Template.Api.Controllers;
Expand Down Expand Up @@ -145,4 +148,30 @@ public virtual async Task<IActionResult> CreateSampleAsync([FromBody][Required]C

return this.Created("create", response);
}

/// <summary>
/// Upload file.
/// </summary>
/// <param name="file">The file.</param>
/// <param name="cancellationToken">The token used when request is cancelled.</param>
/// <returns>The uploaded file.</returns>
/// <response code="200">OK.</response>
/// <response code="400">Bad Request.</response>
/// <response code="401">Unauthorized.</response>
/// <response code="500">Error occurred.</response>
[HttpPost]
[Route("upload")]
[RequestSizeLimit(1024 * 1024 * 5)]
[Consumes(HttpContentType.FORM)]
[Produces(HttpContentType.JSON)]
[ProducesResponseType((int)HttpStatusCode.OK)]
[ProducesResponseType((int)HttpStatusCode.Unauthorized)]
[ProducesResponseType((int)HttpStatusCode.BadRequest)]
[ProducesResponseType((int)HttpStatusCode.InternalServerError)]
public async Task<IActionResult> UploadAsync([Required]IFormFile file, CancellationToken cancellationToken = default)
{
await Task.CompletedTask;

return this.Ok();
}
}
2 changes: 1 addition & 1 deletion Api/Nano.Template.Api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG DOTNET_ASPNET_VERSION="8.0-jammy"
ARG DOTNET_ASPNET_VERSION="9.0-noble"

FROM mcr.microsoft.com/dotnet/aspnet:$DOTNET_ASPNET_VERSION AS base

Expand Down
2 changes: 1 addition & 1 deletion Api/Nano.Template.Api/Nano.Template.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Configurations>Debug;Release</Configurations>
<AssemblyName>Nano.Template.Api</AssemblyName>
<WarningsAsErrors />
Expand Down
4 changes: 2 additions & 2 deletions Console/.github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ env:
IMAGE_NAME: nano.template.console
SERVICE_NAME: nano-template-console
VERSION: '${{ vars.VERSION }}.${{ github.run_number }}.${{ github.run_attempt }}'
DOTNET_SDK_VERSION: 8.0-jammy
DOTNET_ASPNET_VERSION: 8.0-jammy
DOTNET_SDK_VERSION: 9.0-noble
DOTNET_ASPNET_VERSION: 9.0-noble
AZURE_GROUP: Kubernetes
KUBERNETES_NODEPOOL_COMPUTE: cpu
KUBERNETES_NAMESPACE: default
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
<NoWarn />
<WarningsAsErrors />
Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Version>1.0.0.0</Version>
<RepositoryType>git</RepositoryType>
<LangVersion>latest</LangVersion>
Expand Down
2 changes: 1 addition & 1 deletion Console/Nano.Template.Console/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG DOTNET_ASPNET_VERSION="8.0-jammy"
ARG DOTNET_ASPNET_VERSION="9.0-noble"

FROM mcr.microsoft.com/dotnet/aspnet:$DOTNET_ASPNET_VERSION AS base

Expand Down
2 changes: 1 addition & 1 deletion Console/Nano.Template.Console/Nano.Template.Console.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<Version>1.0.0.0</Version>
Expand Down
4 changes: 2 additions & 2 deletions Service/.github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ env:
IMAGE_NAME: nano.template.service
SERVICE_NAME: nano-template-service
VERSION: '${{ vars.VERSION }}.${{ github.run_number }}.${{ github.run_attempt }}'
DOTNET_SDK_VERSION: 8.0-jammy
DOTNET_ASPNET_VERSION: 8.0-jammy
DOTNET_SDK_VERSION: 9.0-noble
DOTNET_ASPNET_VERSION: 9.0-noble
MYSQL_DATABASE_NAME: serviceDb
MYSQL_DATABASE_USER: nano-template-service-user
AZURE_GROUP: Kubernetes
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<IsPackable>false</IsPackable>
<LangVersion>latest</LangVersion>
<NoWarn />
Expand All @@ -10,9 +10,9 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="MSTest.TestAdapter" Version="3.6.4" />
<PackageReference Include="MSTest.TestFramework" Version="3.6.4" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Authors>Michael Vivet</Authors>
<Product>Nano.Template.Service.Events</Product>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<LangVersion>latest</LangVersion>
<Authors>Michael Vivet</Authors>
<Product>Nano.Template.Service.Models</Product>
Expand Down
2 changes: 1 addition & 1 deletion Service/Nano.Template.Service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ARG DOTNET_ASPNET_VERSION="8.0-jammy"
ARG DOTNET_ASPNET_VERSION="9.0-noble"

FROM mcr.microsoft.com/dotnet/aspnet:$DOTNET_ASPNET_VERSION AS base

Expand Down
2 changes: 1 addition & 1 deletion Service/Nano.Template.Service/Nano.Template.Service.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ApplicationIcon />
<OutputType>Exe</OutputType>
<Version>1.0.0.0</Version>
Expand Down

0 comments on commit c6d26b3

Please sign in to comment.