Skip to content

Commit

Permalink
Use central package management for easy updates NuGet packages (#222)
Browse files Browse the repository at this point in the history
### Summary & Motivation

This update introduces central package management for NuGet packages, a
feature from .NET 6. It involves adding a `Directory.Packages.props`
file in the root of the solution. All `.csproj` files have been updated
to not specify versions.

### Checklist

- [x] I have added a Label to the pull-request
- [x] I have added tests, and done manual regression tests
- [x] I have updated the documentation, if necessary
  • Loading branch information
tjementum authored Nov 20, 2023
2 parents f79ca44 + ff889ca commit b586bb0
Show file tree
Hide file tree
Showing 9 changed files with 80 additions and 36 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ jobs:
run: dotnet tool restore

- name: Restore .NET dependencies
run: dotnet restore application/PlatformPlatform.sln
working-directory: application
run: dotnet restore

- name: Build
run: dotnet build application/PlatformPlatform.sln --no-restore --configuration Release /p:Version=${{ steps.generate_version.outputs.version }}
Expand Down
43 changes: 43 additions & 0 deletions application/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
</PropertyGroup>

<ItemGroup>
<!-- PlatformPlatform dependencies - Api -->
<PackageVersion Include="Microsoft.AspNetCore.Mvc.ApiExplorer" Version="2.2.0"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0"/>
<PackageVersion Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
<!-- PlatformPlatform dependencies - Application -->
<PackageVersion Include="Mapster" Version="7.4.0"/>
<PackageVersion Include="MediatR" Version="12.2.0"/>
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0"/>
<!-- PlatformPlatform dependencies - Domain-->
<PackageVersion Include="IdGen" Version="3.0.3"/>
<PackageVersion Include="JetBrains.Annotations" Version="2023.3.0"/>
<PackageVersion Include="MediatR.Contracts" Version="2.0.1"/>
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0"/>
<PackageVersion Include="NUlid" Version="1.7.1"/>
<!-- PlatformPlatform dependencies - Infrastructure -->
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.0"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0"/>
<PackageVersion Include="Scrutor" Version="4.2.2"/>
<!-- PlatformPlatform dependencies - Tests -->
<PackageVersion Include="Bogus" Version="34.0.2"/>
<PackageVersion Include="coverlet.collector" Version="6.0.0"/>
<PackageVersion Include="FluentAssertions" Version="6.12.0"/>
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0"/>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0"/>
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.7.2"/>
<PackageVersion Include="NetArchTest.Rules" Version="1.3.2"/>
<PackageVersion Include="NJsonSchema" Version="10.9.0"/>
<PackageVersion Include="NSubstitute" Version="5.1.0"/>
<PackageVersion Include="xunit" Version="2.6.2"/>
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.4"/>
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion application/account-management/Api/Api.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
22 changes: 11 additions & 11 deletions application/account-management/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,20 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Bogus" Version="34.0.2"/>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="Bogus"/>
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NetArchTest.Rules" Version="1.3.2"/>
<PackageReference Include="NJsonSchema" Version="10.9.0"/>
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Include="FluentAssertions"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing"/>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite"/>
<PackageReference Include="Microsoft.NET.Test.Sdk"/>
<PackageReference Include="NetArchTest.Rules"/>
<PackageReference Include="NJsonSchema"/>
<PackageReference Include="NSubstitute"/>
<PackageReference Include="xunit"/>
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions application/shared-kernel/ApiCore/ApiCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.ApiExplorer" Version="2.2.0"/>
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0"/>
<PackageReference Include="Microsoft.AspNetCore.Mvc.ApiExplorer"/>
<PackageReference Include="Swashbuckle.AspNetCore"/>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Mapster" Version="7.4.0" />
<PackageReference Include="MediatR" Version="12.2.0" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" Version="11.8.0" />
<PackageReference Include="Mapster"/>
<PackageReference Include="MediatR" />
<PackageReference Include="FluentValidation.DependencyInjectionExtensions" />
</ItemGroup>

</Project>
10 changes: 5 additions & 5 deletions application/shared-kernel/DomainCore/DomainCore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="IdGen" Version="3.0.3"/>
<PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<PackageReference Include="MediatR.Contracts" Version="2.0.1"/>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
<PackageReference Include="NUlid" Version="1.7.1"/>
<PackageReference Include="IdGen" />
<PackageReference Include="JetBrains.Annotations" />
<PackageReference Include="MediatR.Contracts" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
<PackageReference Include="NUlid" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.0">
<PackageReference Include="Microsoft.EntityFrameworkCore" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Scrutor" Version="4.2.2"/>
<PackageReference Include="Scrutor" />
</ItemGroup>

</Project>
18 changes: 9 additions & 9 deletions application/shared-kernel/Tests/Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="6.12.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="NetArchTest.Rules" Version="1.3.2"/>
<PackageReference Include="NSubstitute" Version="5.1.0" />
<PackageReference Include="xunit" Version="2.6.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.4">
<PackageReference Include="FluentAssertions" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Testing" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="NetArchTest.Rules" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="6.0.0">
<PackageReference Include="coverlet.collector">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down

0 comments on commit b586bb0

Please sign in to comment.