Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 9, 2025

Summary

Fixes #11888 by multi-targeting all component libraries under src/Components to net8.0;net9.0.

Problem

Users encountered a NuGet downgrade error (NU1605) when using Aspire component packages in .NET 9 projects:

error NU1605: Warning As Error: Detected package downgrade: Microsoft.Extensions.Hosting.Abstractions from 9.0.9 to 8.0.1. 
Reference the package directly from the project to select a different version. 
  otel.QueueCommon -> Aspire.RabbitMQ.Client 9.5.1 -> Microsoft.Extensions.DependencyInjection.AutoActivation 9.9.0 -> Microsoft.Extensions.Hosting.Abstractions (>= 9.0.9) 
  otel.QueueCommon -> Aspire.RabbitMQ.Client 9.5.1 -> Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)

This occurred because:

  1. Component packages targeted only net8.0, which references Microsoft.Extensions.Hosting.Abstractions 8.0.1
  2. They depend on Microsoft.Extensions.DependencyInjection.AutoActivation 9.9.0
  3. AutoActivation 9.9.0 requires Microsoft.Extensions.Hosting.Abstractions >= 9.0.9
  4. This created a downgrade conflict when the packages were consumed by .NET 9 projects

Solution

Multi-targeted all component libraries to net8.0;net9.0 following the established pattern used by other Aspire components like Aspire.Microsoft.Data.SqlClient. This allows the packages to reference framework-appropriate dependency versions:

  • net8.0: Microsoft.Extensions.Hosting.Abstractions 8.0.1
  • net9.0: Microsoft.Extensions.Hosting.Abstractions 9.0.9

When consumed by a .NET 9 project, NuGet now selects the net9.0 build 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>:

  • Aspire.Azure.Data.Tables
  • Aspire.Azure.Messaging.EventHubs
  • Aspire.Azure.Messaging.ServiceBus
  • Aspire.Azure.Messaging.WebPubSub
  • Aspire.Azure.Npgsql
  • Aspire.Azure.Search.Documents
  • Aspire.Azure.Security.KeyVault
  • Aspire.Azure.Storage.Blobs
  • Aspire.Azure.Storage.Queues
  • Aspire.Confluent.Kafka
  • Aspire.Keycloak.Authentication
  • Aspire.Microsoft.Azure.Cosmos
  • Aspire.Microsoft.Azure.StackExchangeRedis
  • Aspire.Microsoft.Extensions.Configuration.AzureAppConfiguration
  • Aspire.Milvus.Client
  • Aspire.MongoDB.Driver
  • Aspire.MongoDB.Driver.v3
  • Aspire.MySqlConnector
  • Aspire.NATS.Net
  • Aspire.Npgsql
  • Aspire.Qdrant.Client
  • Aspire.RabbitMQ.Client
  • Aspire.RabbitMQ.Client.v7
  • Aspire.Seq
  • Aspire.StackExchange.Redis
  • Aspire.StackExchange.Redis.DistributedCaching
  • Aspire.StackExchange.Redis.OutputCaching

Note: Aspire.Pomelo.EntityFrameworkCore.MySql and Aspire.Oracle.EntityFrameworkCore remain single-targeted to net8.0 because 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

  • ✅ All 27 projects build successfully for both net8.0 and net9.0
  • ✅ All existing tests pass for updated packages
  • ✅ Verified NuGet packages contain correct framework-specific dependency groups
  • ✅ Test projects using the packages restore and build without NU1605 warnings
  • ✅ Restore completes successfully for the entire solution

Fixes #11888

Original prompt

This section details on the original issue you should resolve

<issue_title>RabbitMQ client breaks build with nuget dependency downgrade error</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

When using the RabbitMQ client with the latest Aspire 9.5.1, I can no longer build my project due to nuget dependencies...
Both nuget packages

Aspire.RabbitMQ.Client
Aspire.RabbitMQ.Client.v7

Expected Behavior

No response

Steps To Reproduce

No response

Exceptions (if any)

> dotnet build                             
    /Users/depechie/Projects/OpenTelemetryGrafana/code/otel.QueueCommon/otel.QueueCommon.csproj : error NU1605: 
      Warning As Error: Detected package downgrade: Microsoft.Extensions.Hosting.Abstractions from 9.0.9 to 8.0.1. Reference the package directly from the project to select a different version. 
       otel.QueueCommon -> Aspire.RabbitMQ.Client 9.5.1 -> Microsoft.Extensions.DependencyInjection.AutoActivation 9.9.0 -> Microsoft.Extensions.Hosting.Abstractions (>= 9.0.9) 
       otel.QueueCommon -> Aspire.RabbitMQ.Client 9.5.1 -> Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)

.NET Version info

Aspire version 9.5.0

Anything else?

No response</issue_description>

<agent_instructions>Please multi-target Aspire.Rabbit.Client and Aspire.RabbitMQ.Client.v7 libraries to net8.0;net9.0</agent_instructions>

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

@davidfowl @joperezr @eerhardt @joperezr We will likely need to have these libraries multi-target to fix this downgrade. @eerhardt Let's multi-target to fix this. I'll assign copilot

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.

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
Copilot AI requested a review from eerhardt October 9, 2025 21:10
Copilot finished work on behalf of eerhardt October 9, 2025 21:10
…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
Copilot AI requested a review from eerhardt October 9, 2025 21:38
Copilot finished work on behalf of eerhardt October 9, 2025 21:38
@github-actions
Copy link
Contributor

github-actions bot commented Oct 10, 2025

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.sh | bash -s -- 11932

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/dotnet/aspire/main/eng/scripts/get-aspire-cli-pr.ps1) } 11932"

@eerhardt eerhardt marked this pull request as ready for review October 17, 2025 23:16
@eerhardt eerhardt requested review from Copilot and joperezr October 17, 2025 23:16
Copy link
Contributor

Copilot AI left a 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

@davidfowl davidfowl merged commit 99177a6 into main Oct 18, 2025
302 checks passed
@dotnet-policy-service dotnet-policy-service bot added this to the 13.0 milestone Oct 18, 2025
@eerhardt eerhardt deleted the copilot/fix-rabbitmq-client-build-error branch October 20, 2025 14:42
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.

RabbitMQ client breaks build with nuget dependency downgrade error

3 participants