Skip to content

Conversation

@Daymannovaes
Copy link

Summary

Migrates Mockaco from .NET 6.0 to .NET 9.0, including all dependencies and necessary code changes.

Changes Made

Framework Migration

  • ✅ Updated all 3 projects to target net9.0:
    • Mockaco.AspNetCore (Library)
    • Mockaco (Console/Tool)
    • Mockaco.AspNetCore.Tests (Tests)
  • ✅ Configured .NET 9.0.307 SDK via .tool-versions

Code Changes (Breaking Changes Fixed)

  1. InvalidMockException.cs

    • Removed obsolete serialization constructor (SYSLIB0051)
    • Cleaned up unused using statements
  2. ResponseMockingMiddleware.cs

    • Changed response.Headers.Add() to response.Headers.Append() (ASP0019)
    • Prevents ArgumentException on duplicate headers

NuGet Package Updates

Framework-Specific (Required)

  • Microsoft.Extensions.FileProviders.Physical: 6.0.0 → 10.0.0
  • GitVersion.MsBuild: 5.12.0 → 6.5.0

Critical Updates

  • Microsoft.CodeAnalysis.CSharp.Scripting: 4.6.0 → 5.0.0 (Roslyn - core C# scripting feature)
  • Serilog.AspNetCore: 7.0.0 → 9.0.0
  • Serilog.Settings.Configuration: 7.0.0 → 9.0.0
  • Serilog.Sinks.Console: 4.1.0 → 6.1.1
  • Serilog.Sinks.File: 5.0.0 → 7.0.0

Test Infrastructure

  • Microsoft.NET.Test.Sdk: 17.6.2 → 18.0.1
  • xunit: 2.4.2 → 2.9.3
  • xunit.runner.visualstudio: 2.4.5 → 3.1.5
  • coverlet.collector: 6.0.0 → 6.0.4

Optional Packages

  • Bogus: 34.0.2 → 35.6.5
  • Newtonsoft.Json: 13.0.3 → 13.0.4
  • Microsoft.OpenApi.Readers: 1.6.4 → 1.6.28
  • FluentAssertions: 6.11.0 → 8.8.0
  • Moq: 4.18.4 → 4.20.72
  • Testcontainers: 3.2.0 → 4.8.1

Notes on System.CommandLine

  • Kept at 2.0.0-beta1.21308.1 (not upgraded to GA 2.0.0)
  • Reason: GA version has breaking API changes requiring significant refactoring
  • Current beta version works perfectly with .NET 9

Test Results

All 70 tests passing

  • Runtime: 7.0 seconds
  • No new test failures introduced
  • 6 nullable reference warnings remain (pre-existing, non-critical)

Pending Work (Future PRs)

This PR focuses on the core migration. The following tasks are documented but not included:

  • Update GitHub Actions workflow (.github/workflows/main-release.yml)
  • Update Dockerfile to use .NET 9 base images
  • Update README.md with .NET 9 requirements
  • Address nullable reference warnings in test files

Testing Checklist

  • All unit tests pass
  • Build succeeds in Debug mode
  • Build succeeds in Release mode
  • Core Roslyn scripting functionality works (critical feature)
  • Template transformation works
  • Middleware pipeline works
  • Docker build (pending Dockerfile update)
  • CI/CD pipeline (pending GitHub Actions update)

Migration Documentation

See MIGRATION_PLAN.md for complete migration details, including:

  • Detailed package update rationale
  • Breaking change analysis
  • Risk assessment
  • Rollback procedures

References


🤖 Generated with Claude Code

Daymannovaes and others added 8 commits November 19, 2025 21:29
Document successful migration from .NET 6 to .NET 9:
- All 3 projects migrated to net9.0
- 18 NuGet packages updated
- 2 breaking changes fixed
- All 70 tests passing

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Daymannovaes Daymannovaes changed the title Migrate from .NET 6 to .NET 9 with Claude Code Migrate from .NET 6 to .NET 9 with IEBT Migrator Nov 22, 2025
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.

1 participant