Skip to content

Conversation

Copy link

Copilot AI commented Oct 8, 2025

Overview

This PR updates the entire solution from .NET 6.0 (which is now out of support) to .NET 9.0, the latest stable version. All NuGet packages have been updated to their latest compatible versions.

Motivation

.NET 6.0 reached end of support and is no longer receiving security updates. The build system was showing warnings:

warning NETSDK1138: The target framework 'net6.0' is out of support and will not receive security updates in the future.

Additionally, many packages were using versions from 2022 and needed to be brought up to date.

Changes Made

Target Framework Updates

All four projects have been updated:

  • DIDemo (main web application)
  • DIDemoServices (service library)
  • DIDemo.Tests (unit tests)
  • DIDemo.Services.Tests (service tests)

Updated from net6.0net9.0

Package Updates

Main Application (DIDemo):

  • Entity Framework Core packages: 6.0.79.0.1
  • Microsoft.Extensions packages: 6.0.09.0.1
  • ASP.NET Core packages: 6.0.79.0.1

Services Library (DIDemoServices):

  • Configuration abstractions: 6.0.09.0.1
  • Newtonsoft.Json: 13.0.113.0.3

Test Projects:

  • Microsoft.NET.Test.Sdk: 17.2.017.12.0
  • MSTest packages: 2.2.103.7.0

Code Modernization

Updated Program.cs to use the modern .NET hosting pattern:

Before:

public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
    WebHost.CreateDefaultBuilder(args)
        .UseStartup<Startup>();

After:

public static IHostBuilder CreateHostBuilder(string[] args) =>
    Host.CreateDefaultBuilder(args)
        .ConfigureWebHostDefaults(webBuilder =>
        {
            webBuilder.UseStartup<Startup>();
        });

This aligns with the recommended .NET hosting model while maintaining full compatibility with the existing Startup class pattern.

Verification

✅ All projects build successfully with zero warnings
✅ All unit tests pass (2/2 test projects)
✅ No breaking changes to existing functionality
✅ Minimal code changes - only version updates and hosting modernization

Benefits

  • Security: Access to the latest security patches and updates
  • Performance: .NET 9.0 includes numerous performance improvements
  • Support: Active support from Microsoft through November 2026
  • Modern Features: Access to the latest C# language features and runtime improvements

Migration Notes

This update is fully backward compatible with the existing codebase. No changes are required to existing services, controllers, or business logic. The Dependency Injection patterns demonstrated in this repository continue to work identically in .NET 9.0.

Original prompt

This section details on the original issue you should resolve

<issue_title>Update Dependencies and .NET</issue_title>
<issue_description>Update all packages and dependencies. Take .NET to the latest version.</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #253

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

Co-authored-by: codebytes <47988+codebytes@users.noreply.github.com>
Copilot AI changed the title [WIP] Update all packages and upgrade to latest .NET version Update all dependencies and .NET to version 9.0 Oct 8, 2025
Copilot AI requested a review from codebytes October 8, 2025 01:18
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.

Update Dependencies and .NET

2 participants