Skip to content

Refactor PackageVersions and dependencies#7037

Merged
eerhardt merged 3 commits intomicrosoft:mainfrom
eerhardt:FixDirectoryPackagesProps
Jan 11, 2025
Merged

Refactor PackageVersions and dependencies#7037
eerhardt merged 3 commits intomicrosoft:mainfrom
eerhardt:FixDirectoryPackagesProps

Conversation

@eerhardt
Copy link
Copy Markdown
Member

@eerhardt eerhardt commented Jan 7, 2025

In the dotnet/aspire repo today, the way we switch out dependency versions between net8 and net9 doesn't work if you only target a single TFM - net9.0. This is because we have an MSBuild Property condition based on TargetFramework, which isn't set at property evaluation time.

To fix this, refactor the condition to be an ItemGroup condition on TargetFramework, which gets evaluated after properties get set, so TargetFramework is set. This follows the same approach used in dotnet/extensions.

  • To also follow dotnet/extensions (and so the property names aren't so long), I changed the PackageVersion suffix to just Version.

Comment thread Directory.Packages.props

<!-- The following 2 groups are for packages that need to switch based on the .NET TFM being used. -->

<ItemGroup>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

NIT: Should this be conditioned as well for net8 tfm?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

My thinking was that these are unconditional, and then the "STS" version "updates" the PackageVersion. Either way could work, I don't have strong opinion. Do you?

Copy link
Copy Markdown
Member

@joperezr joperezr left a comment

Choose a reason for hiding this comment

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

Couple of questions but looks great overall. Thanks!

In the dotnet/aspire repo today, the way we switch out dependency versions between net8 and net9 doesn't work if you only target a single TFM - net9.0. This is because we have an MSBuild Property condition based on TargetFramework, which isn't set at property evaluation time.

To fix this, refactor the condition to be an ItemGroup condition on TargetFramework, which gets evaluated after properties get set, so TargetFramework is set. This follows the same approach used in dotnet/extensions.

- To also follow dotnet/extensions (and so the property names aren't so long), I changed the PackageVersion suffix to just Version.
@eerhardt eerhardt force-pushed the FixDirectoryPackagesProps branch from 4e3334d to ba1000f Compare January 10, 2025 00:35
@eerhardt
Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

@eerhardt eerhardt merged commit be90451 into microsoft:main Jan 11, 2025
@eerhardt eerhardt deleted the FixDirectoryPackagesProps branch January 11, 2025 03:38
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 10, 2025
@github-actions github-actions Bot added the area-integrations Issues pertaining to Aspire Integrations packages label Mar 10, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-integrations Issues pertaining to Aspire Integrations packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants