diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 928e9f0..240f23c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -1,7 +1,7 @@ ## General - Make only high confidence suggestions when reviewing code changes. -- Always use the latest version C#, currently C# 13 features. +- Always use the latest version C#, currently C# 14 features. - Write code that is clean, maintainable, and easy to understand. - Only add comments rarely to explain why a non-intuitive solution was used. The code should be self-explanatory otherwise. - Don't add the UTF-8 BOM to files unless they have non-ASCII characters. diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c333a30..8b5af46 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,7 @@ on: env: AZURE_WEBAPP_NAME: pdfsmith AZURE_WEBAPP_PACKAGE_PATH: './published' - NET_VERSION: '9.x' + NET_VERSION: '10.x' PROJECT_NAME: src/PdfSmith RUNTIME: linux-x64 diff --git a/src/PdfSmith.BusinessLayer/PdfSmith.BusinessLayer.csproj b/src/PdfSmith.BusinessLayer/PdfSmith.BusinessLayer.csproj index 0e03429..2e7a37c 100644 --- a/src/PdfSmith.BusinessLayer/PdfSmith.BusinessLayer.csproj +++ b/src/PdfSmith.BusinessLayer/PdfSmith.BusinessLayer.csproj @@ -1,20 +1,20 @@  - net9.0 + net10.0 enable enable - + - - + + - - + + diff --git a/src/PdfSmith.DataAccessLayer/PdfSmith.DataAccessLayer.csproj b/src/PdfSmith.DataAccessLayer/PdfSmith.DataAccessLayer.csproj index 719ebb2..486f95d 100644 --- a/src/PdfSmith.DataAccessLayer/PdfSmith.DataAccessLayer.csproj +++ b/src/PdfSmith.DataAccessLayer/PdfSmith.DataAccessLayer.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable @@ -11,7 +11,7 @@ - + diff --git a/src/PdfSmith.Shared/PdfSmith.Shared.csproj b/src/PdfSmith.Shared/PdfSmith.Shared.csproj index 125f4c9..b760144 100644 --- a/src/PdfSmith.Shared/PdfSmith.Shared.csproj +++ b/src/PdfSmith.Shared/PdfSmith.Shared.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable diff --git a/src/PdfSmith/BackgroundServices/InstallPlaywrightBackgroundService.cs b/src/PdfSmith/BackgroundServices/InstallPlaywrightBackgroundService.cs index 9c26162..b15210c 100644 --- a/src/PdfSmith/BackgroundServices/InstallPlaywrightBackgroundService.cs +++ b/src/PdfSmith/BackgroundServices/InstallPlaywrightBackgroundService.cs @@ -4,22 +4,20 @@ namespace PdfSmith.BackgroundServices; public class InstallPlaywrightBackgroundService(PlaywrightHealthCheck playwrightHealthCheck, ILogger logger) : BackgroundService { - protected override async Task ExecuteAsync(CancellationToken stoppingToken) + protected override Task ExecuteAsync(CancellationToken stoppingToken) { // On Windows, it is installed in %USERPROFILE%\AppData\Local\ms-playwright by default. // We can use PLAYWRIGHT_BROWSERS_PATH environment variable to change the default location. - var returnCode = await Task.Run(() => + var returnCode = -1; + + try + { + returnCode = Microsoft.Playwright.Program.Main(["install", "chromium"]); + } + catch (Exception ex) { - try - { - return Microsoft.Playwright.Program.Main(["install", "chromium"]); - } - catch (Exception ex) - { - logger.LogError(ex, "Error while installing Chromium"); - return -1; - } - }, stoppingToken); + logger.LogError(ex, "Error while installing Chromium"); + } var playwrightStatus = returnCode switch { @@ -28,5 +26,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken) }; playwrightHealthCheck.Status = playwrightStatus; + + return Task.CompletedTask; } } \ No newline at end of file diff --git a/src/PdfSmith/PdfSmith.csproj b/src/PdfSmith/PdfSmith.csproj index 7605634..24b44f4 100644 --- a/src/PdfSmith/PdfSmith.csproj +++ b/src/PdfSmith/PdfSmith.csproj @@ -1,7 +1,7 @@  - net9.0 + net10.0 enable enable true @@ -9,21 +9,21 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - + + + - - - - + + + + diff --git a/src/PdfSmith/Program.cs b/src/PdfSmith/Program.cs index 44dbd81..2794237 100644 --- a/src/PdfSmith/Program.cs +++ b/src/PdfSmith/Program.cs @@ -10,7 +10,7 @@ using Microsoft.AspNetCore.Localization; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Diagnostics.HealthChecks; -using Microsoft.OpenApi.Models; +using Microsoft.OpenApi; using MinimalHelpers.FluentValidation; using OperationResults.AspNetCore.Http; using PdfSmith.BackgroundServices;