Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<TestcontainersPackageVersion>4.0.0</TestcontainersPackageVersion>
<AzureProvisiongVersion>1.0.0</AzureProvisiongVersion>
<!-- The Npgsql version used when using Npgsql EF Core on net8. The major versions need to match between Npgsql and EF Core. -->
<Npgsql8Version>8.0.6</Npgsql8Version>
Comment thread
eerhardt marked this conversation as resolved.
</PropertyGroup>
<ItemGroup>
<!-- Azure SDK for .NET dependencies -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<ItemGroup>
<AspireProjectOrPackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
Comment thread
eerhardt marked this conversation as resolved.
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />
</ItemGroup>

Expand Down
6 changes: 5 additions & 1 deletion playground/TestShop/CatalogDb/CatalogDb.csproj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>$(DefaultTargetFramework)</TargetFramework>
Expand All @@ -13,6 +13,10 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
</ItemGroup>

</Project>
7 changes: 3 additions & 4 deletions playground/TestShop/CatalogModel/CatalogModel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
</ItemGroup>

<ItemGroup>
<AspireProjectOrPackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
</ItemGroup>

</Project>
8 changes: 4 additions & 4 deletions playground/TestShop/CatalogService/CatalogService.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
<Content Include="Images\**\*" CopyToOutputDirectory="PreserveNewest" CopyToPublishDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CatalogModel\CatalogModel.csproj" />
<ProjectReference Include="..\TestShop.ServiceDefaults\TestShop.ServiceDefaults.csproj" />

<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
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 we consider doing the override in a single place (like a directory.build.props so all of these testshop projects can benefit) and that way we reduce the number of places that need to be updated come .net 10?

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.

We should only override the PackageRefernce if the app is also referencing Npgsql EF Core. There are only a handful of playground apps use it. We can't do it in a single place without affecting the projects that don't want it.

The real problem here is transitive pinning. Since most projects want Npgsql v9, we use that in our Directory.Packages.props (even when targeting net8 - see #6946). But when an app is targeting net8 -> it needs EF Core 8. And if it uses EF Core 8 -> it needs Ngpsql 8.

<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<AspireProjectOrPackageReference Include="Aspire.Microsoft.Azure.Cosmos" />
<AspireProjectOrPackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" />
<AspireProjectOrPackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<AspireProjectOrPackageReference Include="Aspire.StackExchange.Redis" />
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
<AspireProjectOrPackageReference Include="Aspire.Microsoft.EntityFrameworkCore.Cosmos" />
<AspireProjectOrPackageReference Include="Aspire.Microsoft.EntityFrameworkCore.SqlServer" />
<AspireProjectOrPackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<AspireProjectOrPackageReference Include="Aspire.StackExchange.Redis" />
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

<ItemGroup>
<AspireProjectOrPackageReference Include="Aspire.Npgsql.EntityFrameworkCore.PostgreSQL" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<ProjectReference Include="..\..\Playground.ServiceDefaults\Playground.ServiceDefaults.csproj" />
<ProjectReference Include="..\WaitForSandbox.Common\WaitForSandbox.Common.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

<ItemGroup>
<ProjectReference Include="..\..\..\src\Components\Aspire.Npgsql.EntityFrameworkCore.PostgreSQL\Aspire.Npgsql.EntityFrameworkCore.PostgreSQL.csproj" />
<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
<ProjectReference Include="..\WaitForSandbox.Common\WaitForSandbox.Common.csproj" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@

<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Update="Npgsql.DependencyInjection" VersionOverride="8.0.6" />
<PackageReference Update="Npgsql.OpenTelemetry" VersionOverride="8.0.6" />
<PackageReference Update="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Update="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

<!-- Npgsql EF needs to match the same major version as the underlying Npgsql assemblies. -->
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="8.0.6" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="8.0.6" />
<PackageReference Include="Npgsql.DependencyInjection" VersionOverride="$(Npgsql8Version)" />
<PackageReference Include="Npgsql.OpenTelemetry" VersionOverride="$(Npgsql8Version)" />
</ItemGroup>

</Project>