Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
135 changes: 135 additions & 0 deletions MIGRATION_NET10.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
# Migration vers .NET 10

## Date de migration
25 décembre 2024

## Résumé
Ce document décrit les modifications effectuées pour migrer le projet BrilliantMediator et tous ses projets dépendants de .NET 9 vers .NET 10.

## Projets migrés

Tous les projets suivants ont été migrés de `net9.0` vers `net10.0` :

### 1. **BrilliantMediator** (src/BrilliantMediator/BrilliantMediator.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- Microsoft.Extensions.DependencyInjection.Abstractions: `9.0.10` → `10.0.0`
- Microsoft.Extensions.Hosting.Abstractions: `9.0.10` → `10.0.0`
- Microsoft.AspNetCore.Http.Abstractions: `2.3.0` (inchangé, pas de version .NET 10 disponible)
Comment thread
oliver254 marked this conversation as resolved.
Outdated

### 2. **BrilliantMediator.Tests** (tests/BrilliantMediator.Tests/BrilliantMediator.Tests.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- Microsoft.Extensions.DependencyInjection: `9.0.10` → `10.0.0`
- Autres packages de test inchangés (versions stables)
Comment thread
oliver254 marked this conversation as resolved.
Outdated

### 3. **ConsoleApp** (samples/ConsoleApp/ConsoleApp.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- Microsoft.Extensions.DependencyInjection: `9.0.10` → `10.0.0`

### 4. **EcommerceDDD.Domain** (samples/EcommerceDDD/EcommerceDDD.Domain/EcommerceDDD.Domain.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Aucune dépendance NuGet externe

### 5. **EcommerceDDD.Application** (samples/EcommerceDDD/EcommerceDDD.Application/EcommerceDDD.Application.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- Microsoft.Extensions.Logging.Abstractions: `9.0.10` → `10.0.0`

### 6. **EcommerceDDD.Infrastructure** (samples/EcommerceDDD/EcommerceDDD.Infrastructure/EcommerceDDD.Infrastructure.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- Microsoft.Extensions.DependencyInjection: `9.0.0` → `10.0.0`
- Microsoft.Extensions.Logging: `9.0.0` → `10.0.0`

### 7. **EcommerceDDD.WebApi** (samples/EcommerceDDD/EcommerceDDD.Api/EcommerceDDD.WebApi.csproj)
- TargetFramework: `net9.0` → `net10.0`
- Packages NuGet mis à jour :
- **Suppression** de `Microsoft.AspNetCore.OpenApi` (incompatibilité avec Swashbuckle)
- Swashbuckle.AspNetCore: `9.0.6` → `10.1.0`
- Serilog.AspNetCore: `9.0.0` → `10.0.0`
- Serilog.Sinks.File: `7.0.0` (inchangé)

## Modifications de code

### Program.cs (EcommerceDDD.WebApi)
- **Changement de namespace** : `Microsoft.OpenApi.Models.OpenApiInfo` → `Microsoft.OpenApi.OpenApiInfo`
- Raison : Le namespace a été simplifié dans Microsoft.OpenApi v3.x

```csharp
// Avant
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo { ... });

// Après
options.SwaggerDoc("v1", new Microsoft.OpenApi.OpenApiInfo { ... });
Comment thread
oliver254 marked this conversation as resolved.
Outdated
```
Comment thread
oliver254 marked this conversation as resolved.
Outdated

## Problèmes rencontrés et solutions

### Problème 1 : Incompatibilité Microsoft.AspNetCore.OpenApi
- **Erreur** : Incompatibilité entre Microsoft.AspNetCore.OpenApi 10.0.0 et Microsoft.OpenApi (versions multiples)
- **Solution** : Suppression de Microsoft.AspNetCore.OpenApi car Swashbuckle.AspNetCore 10.1.0 le remplace

### Problème 2 : Source Generator incompatible
- **Erreur** : `CS0200: Impossible d'assigner la propriété 'IOpenApiMediaType.Example' -- il est en lecture seule`
- **Solution** : Suppression complète de Microsoft.AspNetCore.OpenApi et utilisation exclusive de Swashbuckle

### Problème 3 : Namespace OpenApiInfo changé
- **Erreur** : `CS0234: Le nom de type ou d'espace de noms 'Models' n'existe pas`
- **Solution** : Mise à jour du namespace de `Microsoft.OpenApi.Models` vers `Microsoft.OpenApi`

## Vérification

La build a été testée avec succès après migration :
```bash
dotnet build
```

Résultat : ✅ **Génération réussie**
Comment thread
oliver254 marked this conversation as resolved.
Outdated

## Packages NuGet - Versions finales

| Package | Version |
|---------|---------|
| Microsoft.Extensions.DependencyInjection | 10.0.0 |
| Microsoft.Extensions.DependencyInjection.Abstractions | 10.0.0 |
| Microsoft.Extensions.Hosting.Abstractions | 10.0.0 |
| Microsoft.Extensions.Logging | 10.0.0 |
| Microsoft.Extensions.Logging.Abstractions | 10.0.0 |
| Swashbuckle.AspNetCore | 10.1.0 |
| Serilog.AspNetCore | 10.0.0 |
| Serilog.Sinks.File | 7.0.0 |
| Microsoft.NET.Test.Sdk | 18.0.0 |
| xunit | 2.9.3 |
| xunit.runner.visualstudio | 3.1.5 |
| coverlet.collector | 6.0.4 |

## Prochaines étapes

1. ✅ Migration complétée
2. 🔄 Tests à exécuter pour valider le bon fonctionnement
3. 📝 Mise à jour du README.md si nécessaire
4. 🚀 Commit et push des changements

## Notes importantes

- ⚠️ **Microsoft.AspNetCore.Http.Abstractions** reste en version 2.3.0 car c'est la dernière version stable disponible
Comment thread
oliver254 marked this conversation as resolved.
Outdated
- ✅ Tous les projets compilent sans erreur ni avertissement
- ✅ La structure du code n'a pas été modifiée, seulement les versions des frameworks et packages

## Commandes Git

```bash
# Vérifier les changements
git status

# Ajouter tous les fichiers modifiés
git add .

# Créer un commit
git commit -m "Migration vers .NET 10 - Mise à jour de tous les projets et packages NuGet"

# Pousser sur la branche
git push origin migrate-dotnet10
```
4 changes: 2 additions & 2 deletions samples/ConsoleApp/ConsoleApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<RootNamespace>Radiant.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.10" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="9.0.6" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="10.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="7.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="../../../src/BrilliantMediator/BrilliantMediator.csproj" />
<ProjectReference Include="../EcommerceDDD.Domain/EcommerceDDD.Domain.csproj" />
<ProjectReference Include="../EcommerceDDD.Application/EcommerceDDD.Application.csproj" />
<ProjectReference Include="../EcommerceDDD.Application/EcommerceDDD.Application.csproj" />
<ProjectReference Include="../EcommerceDDD.Infrastructure/EcommerceDDD.Infrastructure.csproj" />
</ItemGroup>

Expand Down
2 changes: 1 addition & 1 deletion samples/EcommerceDDD/EcommerceDDD.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo
options.SwaggerDoc("v1", new Microsoft.OpenApi.OpenApiInfo
Copy link

Copilot AI Dec 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The namespace Microsoft.OpenApi.OpenApiInfo appears to be incorrect. The standard namespace for OpenApiInfo in Swashbuckle.AspNetCore and Microsoft.OpenApi packages is Microsoft.OpenApi.Models.OpenApiInfo, not Microsoft.OpenApi.OpenApiInfo. This will likely cause a compilation error. Please verify the correct namespace for the version of Swashbuckle.AspNetCore being used.

Suggested change
options.SwaggerDoc("v1", new Microsoft.OpenApi.OpenApiInfo
options.SwaggerDoc("v1", new Microsoft.OpenApi.Models.OpenApiInfo

Copilot uses AI. Check for mistakes.
{
Title = "Ecommerce DDD API",
Version = "v1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
Expand All @@ -15,8 +15,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="10.0.0" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions src/BrilliantMediator/BrilliantMediator.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>true</IsPackable>
Expand All @@ -23,8 +23,8 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting.Abstractions" Version="10.0.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions tests/BrilliantMediator.Tests/BrilliantMediator.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
Expand All @@ -13,7 +13,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="9.0.10" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.0.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand Down
Loading