Skip to content

Conversation

@bart-vmware
Copy link
Member

This PR fixes the following build warning when both ConnectorMySqlOption and ConnectorMySqlEfCoreOption are selected as dependencies:

Sample.csproj : error NU1605: Warning As Error: Detected package downgrade: MySql.Data from 9.4.0 to 9.3.0. Reference the package directly from the project to select a different version. 
Sample.csproj : error NU1605:  Sample -> MySql.EntityFrameworkCore 9.0.6 -> MySql.Data (>= 9.4.0) 
Sample.csproj : error NU1605:  Sample -> MySql.Data (>= 9.3.0)

This happens because new versions of Oracle MySQL packages were released to NuGet:

  • MySql.EntityFrameworkCore 9.0.3 references MySql.Data 9.3.0
  • NEW: MySql.EntityFrameworkCore 9.0.6 references MySql.Data 9.4.0

The generated project references MySql.EntityFrameworkCore 9.0.*, so it picks the new version. This conflicts with the hard-coded version we use for MySql.Data, which is still at 9.3.0. This hardcoded version is needed because Steeltoe.Connectors does not reference driver packages.

To fix this, we should not reference assemblies that are transitively referenced.

This means:

  • Do not reference Microsoft.Data.SqlClient, which is transitively referenced by Microsoft.EntityFrameworkCore.SqlServer
  • Do not reference MySql.Data, which is transitively referenced by MySql.EntityFrameworkCore
  • Do not reference Npgsql, which is transitively referenced by Npgsql.EntityFrameworkCore.PostgreSQL
  • Do not reference RabbitMQ.Client, which is transitively referenced by Steeltoe.Messaging.RabbitMQ

Unfortunately, this can't be tested with the current test framework, because:

  • There's no support to test a combination of options.
  • There's no way to assert a NuGet reference does not exist.

So I tested this manually.

…to prevent conflicting versions (resulting in a build warning)
@bart-vmware bart-vmware force-pushed the package-version-conflict-fixes branch from 68fd763 to 1a4939f Compare July 23, 2025 09:25
@bart-vmware bart-vmware marked this pull request as ready for review July 23, 2025 10:32
@bart-vmware bart-vmware requested a review from TimHess July 23, 2025 10:33
@bart-vmware bart-vmware merged commit 25ec368 into main Jul 23, 2025
8 checks passed
@bart-vmware bart-vmware deleted the package-version-conflict-fixes branch July 23, 2025 13:13
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.

3 participants