Skip to content

Conversation

Copy link

Copilot AI commented Sep 14, 2025

Fixes the build errors caused by obsolete ASP.NET Core hosting APIs by replacing them with the modern hosting pattern.

Original issue description:

Error: /home/runner/work/Pomelo.EntityFrameworkCore.MySql/Pomelo.EntityFrameworkCore.MySql/test/EFCore.MySql.IntegrationTests/Program.cs(44,23): error ASPDEPR008: 'IWebHost' is obsolete: 'IWebHost is obsolete. Use IHost instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' [/home/runner/work/Pomelo.EntityFrameworkCore.MySql/Pomelo.EntityFrameworkCore.MySql/test/EFCore.MySql.IntegrationTests/EFCore.MySql.IntegrationTests.csproj]
Error: /home/runner/work/Pomelo.EntityFrameworkCore.MySql/Pomelo.EntityFrameworkCore.MySql/test/EFCore.MySql.IntegrationTests/Program.cs(46,20): error ASPDEPR008: 'WebHost' is obsolete: 'WebHost is obsolete. Use HostBuilder or WebApplicationBuilder instead. For more information, visit https://aka.ms/aspnet/deprecate/008.' [/home/runner/work/Pomelo.EntityFrameworkCore.MySql/Pomelo.EntityFrameworkCore.MySql/test/EFCore.MySql.IntegrationTests/EFCore.MySql.IntegrationTests.csproj]

Changes Made

  • Return Type: Changed BuildWebHost method return type from IWebHost to IHost
  • Host Builder: Replaced WebHost.CreateDefaultBuilder(args) with Host.CreateDefaultBuilder(args).ConfigureWebHostDefaults()
  • Using Statements: Updated imports to use Microsoft.Extensions.Hosting instead of obsolete Microsoft.AspNetCore
  • SDK Version: Updated to use .NET 10.0.100-preview.7.25380.108 as requested

The changes maintain the same functionality while using the modern ASP.NET Core hosting pattern that is compatible with .NET 10.

Fixes #88.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

@renemadsen
Copy link
Member

@copilot instructions have been updated to use dotnet 10.0.100-preview.7.25380.108

Copy link
Author

Copilot AI commented Sep 14, 2025

@copilot instructions have been updated to use dotnet 10.0.100-preview.7.25380.108

Updated to use .NET 10.0.100-preview.7.25380.108 SDK and successfully fixed the obsolete IWebHost/WebHost API issues. The code now uses the modern Host.CreateDefaultBuilder().ConfigureWebHostDefaults() pattern instead of the deprecated WebHost APIs. Changes committed in a2d521f.

Copilot AI changed the title [WIP] Stop using obsolete methods Replace obsolete IWebHost and WebHost APIs with modern Host pattern Sep 14, 2025
@renemadsen renemadsen marked this pull request as ready for review September 14, 2025 05:48
@renemadsen renemadsen merged commit 2b1d5bf into master Sep 14, 2025
0 of 54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop using obsolete methods

2 participants