Multi-target all component libraries to fix NuGet downgrade error#11932
Merged
Multi-target all component libraries to fix NuGet downgrade error#11932
Conversation
Co-authored-by: eerhardt <8291187+eerhardt@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix RabbitMQ client build with nuget dependency downgrade error
Multi-target RabbitMQ client libraries to fix NuGet downgrade error
Oct 9, 2025
eerhardt
reviewed
Oct 9, 2025
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>
Copilot
AI
changed the title
Multi-target RabbitMQ client libraries to fix NuGet downgrade error
Multi-target all component libraries to fix NuGet downgrade error
Oct 9, 2025
Contributor
|
🚀 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
Contributor
There was a problem hiding this comment.
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 |
eerhardt
approved these changes
Oct 17, 2025
davidfowl
approved these changes
Oct 18, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.