From f050488b92d7bb6878c6ca44c3ca0ccd92b1ef2e Mon Sep 17 00:00:00 2001 From: Mole Date: Thu, 4 Sep 2025 08:08:35 +0200 Subject: [PATCH] V17: Update to dotnet 10 (#20007) * Update dotnet version * Update packages * Fix System.Linq.Async breaking change * Fix #19867 * Update template.json * Set LTS version to 17 * Update dockerfile --- Directory.Build.props | 2 +- Directory.Packages.props | 61 ++++++++++--------- global.json | 2 +- .../Umbraco.Cms.Api.Delivery.csproj | 10 ++- .../ConfigureBackOfficeCookieOptions.cs | 37 ++++++++++- .../Umbraco.Cms.Api.Management.csproj | 6 ++ .../Umbraco.Infrastructure.csproj | 3 + .../UmbracoExtension/Umbraco.Extension.csproj | 2 +- .../.template.config/template.json | 6 +- templates/UmbracoProject/Dockerfile | 4 +- 10 files changed, 92 insertions(+), 41 deletions(-) diff --git a/Directory.Build.props b/Directory.Build.props index d93557f0ea..09dd04749d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,7 +1,7 @@ - net9.0 + net10.0 Umbraco HQ Umbraco Copyright © Umbraco $([System.DateTime]::Today.ToString('yyyy')) diff --git a/Directory.Packages.props b/Directory.Packages.props index d41b6eb92c..5107faad00 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,37 +7,38 @@ - + - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -86,18 +87,18 @@ - + - + - + diff --git a/global.json b/global.json index 41c9ad2ed8..d5eb15969c 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "sdk": { - "version": "9.0.100", + "version": "10.0.100-preview.7.25380.108", "rollForward": "latestFeature", "allowPrerelease": false } diff --git a/src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj b/src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj index b275c6ad14..a0a728b664 100644 --- a/src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj +++ b/src/Umbraco.Cms.Api.Delivery/Umbraco.Cms.Api.Delivery.csproj @@ -3,7 +3,7 @@ Umbraco CMS - Delivery API Contains the presentation layer for the Umbraco CMS Delivery API. - + $(WarningsNotAsErrors),ASP0019,CS0618,CS0612 - + + + + compile + + + <_Parameter1>Umbraco.Tests.UnitTests diff --git a/src/Umbraco.Cms.Api.Management/Configuration/ConfigureBackOfficeCookieOptions.cs b/src/Umbraco.Cms.Api.Management/Configuration/ConfigureBackOfficeCookieOptions.cs index 88a39d046a..6530738f06 100644 --- a/src/Umbraco.Cms.Api.Management/Configuration/ConfigureBackOfficeCookieOptions.cs +++ b/src/Umbraco.Cms.Api.Management/Configuration/ConfigureBackOfficeCookieOptions.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.DataProtection; using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using Microsoft.Net.Http.Headers; using Umbraco.Cms.Api.Management.Security; using Umbraco.Cms.Core; using Umbraco.Cms.Core.Configuration.Models; @@ -219,10 +220,44 @@ public class ConfigureBackOfficeCookieOptions : IConfigureNamedOptions + { + if (IsXhr(context.Request)) + { + context.Response.Headers.Location = context.RedirectUri; + context.Response.StatusCode = 401; + } + else + { + context.Response.Redirect(context.RedirectUri); + } + + return Task.CompletedTask; + }, + OnRedirectToAccessDenied = context => + { + if (IsXhr(context.Request)) + { + context.Response.Headers.Location = context.RedirectUri; + context.Response.StatusCode = 403; + } + else + { + context.Response.Redirect(context.RedirectUri); + } + + return Task.CompletedTask; + }, }; } + private bool IsXhr(HttpRequest request) => + string.Equals(request.Query[HeaderNames.XRequestedWith], "XMLHttpRequest", StringComparison.Ordinal) || + string.Equals(request.Headers.XRequestedWith, "XMLHttpRequest", StringComparison.Ordinal); + /// /// Ensures the ticket is renewed if the is set to true /// and the current request is for the get user seconds endpoint diff --git a/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj b/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj index 02a8f79580..fc4dad8d30 100644 --- a/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj +++ b/src/Umbraco.Cms.Api.Management/Umbraco.Cms.Api.Management.csproj @@ -28,6 +28,12 @@ + + + compile + + + diff --git a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj index 7df82c5cb0..999ce21e07 100644 --- a/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj +++ b/src/Umbraco.Infrastructure/Umbraco.Infrastructure.csproj @@ -61,6 +61,9 @@ + + compile + diff --git a/templates/UmbracoExtension/Umbraco.Extension.csproj b/templates/UmbracoExtension/Umbraco.Extension.csproj index d6b03e516c..4bc359eaa8 100644 --- a/templates/UmbracoExtension/Umbraco.Extension.csproj +++ b/templates/UmbracoExtension/Umbraco.Extension.csproj @@ -1,6 +1,6 @@ - net9.0 + net10.0 enable enable true diff --git a/templates/UmbracoProject/.template.config/template.json b/templates/UmbracoProject/.template.config/template.json index 21968ef946..7909452deb 100644 --- a/templates/UmbracoProject/.template.config/template.json +++ b/templates/UmbracoProject/.template.config/template.json @@ -98,7 +98,7 @@ }, { "condition": "(UmbracoRelease == 'LTS')", - "value": "13.10.0" + "value": "17.0.0" } ] } @@ -116,11 +116,11 @@ "cases": [ { "condition": "(UmbracoRelease == 'Latest')", - "value": "net9.0" + "value": "net10.0" }, { "condition": "(UmbracoRelease == 'LTS')", - "value": "net8.0" + "value": "net10.0" } ] } diff --git a/templates/UmbracoProject/Dockerfile b/templates/UmbracoProject/Dockerfile index 0e1b379b20..40347ec2ec 100644 --- a/templates/UmbracoProject/Dockerfile +++ b/templates/UmbracoProject/Dockerfile @@ -1,10 +1,10 @@ -FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base USER $APP_UID WORKDIR /app EXPOSE 8080 EXPOSE 8081 -FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build ARG BUILD_CONFIGURATION=Release WORKDIR /src COPY ["UmbracoProject/UmbracoProject.csproj", "UmbracoProject/"]