-
Couldn't load subscription status.
- Fork 713
Multi-target all component libraries to fix NuGet downgrade error #11932
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
src/Components/Aspire.RabbitMQ.Client.v7/Aspire.RabbitMQ.Client.v7.csproj
Show resolved
Hide resolved
…elo and Oracle EF Core) Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
|
🚀 Dogfood this PR with:
curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11932Or
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11932" |
…q-client-build-error
Remove unnecessary comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR resolves a NuGet package downgrade error (NU1605) that occurred when consuming Aspire component packages in .NET 9 projects. The fix multi-targets all 27 component libraries under src/Components to net8.0;net9.0, enabling them to reference framework-appropriate dependency versions and eliminating conflicts with packages like Microsoft.Extensions.DependencyInjection.AutoActivation that require .NET 9 dependencies.
Key changes:
- Multi-targeted 27 component libraries to support both net8.0 and net9.0
- Updated corresponding test projects to multi-target for proper testing coverage
- Removed outdated comments explaining multi-targeting rationale from projects already using it
Reviewed Changes
Copilot reviewed 62 out of 62 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/Components/Aspire.RabbitMQ.Client/Aspire.RabbitMQ.Client.csproj | Multi-targeted to net8.0;net9.0 to fix downgrade error |
| src/Components/Aspire.RabbitMQ.Client.v7/Aspire.RabbitMQ.Client.v7.csproj | Multi-targeted to net8.0;net9.0 to fix downgrade error |
| src/Components/Aspire.StackExchange.Redis/Aspire.StackExchange.Redis.csproj | Multi-targeted to net8.0;net9.0 for consistency |
| src/Components/Aspire.StackExchange.Redis.OutputCaching/Aspire.StackExchange.Redis.OutputCaching.csproj | Multi-targeted to net8.0;net9.0 for consistency |
| src/Components/Aspire.StackExchange.Redis.DistributedCaching/Aspire.StackExchange.Redis.DistributedCaching.csproj | Multi-targeted to net8.0;net9.0 for consistency |
| src/Components/Aspire.OpenAI/Aspire.OpenAI.csproj | Removed outdated comment explaining multi-targeting |
| src/Components/Aspire.Microsoft.Data.SqlClient/Aspire.Microsoft.Data.SqlClient.csproj | Removed outdated comment explaining multi-targeting |
| src/Components/Aspire.Azure.AI.OpenAI/Aspire.Azure.AI.OpenAI.csproj | Removed outdated comment explaining multi-targeting |
| src/Components/Aspire.Azure.AI.Inference/Aspire.Azure.AI.Inference.csproj | Removed outdated comment explaining multi-targeting |
| src/Components/Aspire.*.csproj (23 other files) | Multi-targeted various Azure, database, and messaging component libraries to net8.0;net9.0 |
| tests/Aspire.*.Tests.csproj (33 files) | Updated test projects to multi-target for proper testing of both framework versions |
Summary
Fixes #11888 by multi-targeting all component libraries under
src/Componentstonet8.0;net9.0.Problem
Users encountered a NuGet downgrade error (NU1605) when using Aspire component packages in .NET 9 projects:
This occurred because:
net8.0, which referencesMicrosoft.Extensions.Hosting.Abstractions 8.0.1Microsoft.Extensions.DependencyInjection.AutoActivation 9.9.0Microsoft.Extensions.Hosting.Abstractions >= 9.0.9Solution
Multi-targeted all component libraries to
net8.0;net9.0following the established pattern used by other Aspire components likeAspire.Microsoft.Data.SqlClient. This allows the packages to reference framework-appropriate dependency versions:Microsoft.Extensions.Hosting.Abstractions 8.0.1Microsoft.Extensions.Hosting.Abstractions 9.0.9When consumed by a .NET 9 project, NuGet now selects the
net9.0build which has dependencies compatible with .NET 9, eliminating the downgrade warning while maintaining backward compatibility with .NET 8 projects.Changes
Updated 27 component library projects to use
<TargetFrameworks>$(AllTargetFrameworks)</TargetFrameworks>:Note:
Aspire.Pomelo.EntityFrameworkCore.MySqlandAspire.Oracle.EntityFrameworkCoreremain single-targeted tonet8.0because their underlying EF Core providers (Pomelo 8.x and Oracle 8.x) don't support .NET 9/EF Core 9 yet.Added comments explaining the reason for multi-targeting to all updated projects.
Testing
net8.0andnet9.0Fixes #11888
Original prompt
Fixes #11888
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.