Skip to content

Commit

Permalink
Manage Dependencies centrally
Browse files Browse the repository at this point in the history
Manage Packages Centrally using NuGet's CPVM feature.
This uses `Directory.Packages.props` to store the package versions in one file.
  • Loading branch information
Nirmal4G committed Jan 17, 2023
1 parent 4986041 commit a09e743
Show file tree
Hide file tree
Showing 14 changed files with 79 additions and 31 deletions.
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Import Project="$(BuildToolsDirectory)Toolkit.Common.props" />

<ItemGroup>
<PackageReference Include="Nerdbank.GitVersioning" Version="3.5.119" PrivateAssets="All" />
<PackageReference Include="Nerdbank.GitVersioning" PrivateAssets="All" />
</ItemGroup>

<Choose>
Expand All @@ -24,7 +24,7 @@
<AllowedOutputExtensionsInPackageBuildOutputFolder>.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All" />
</ItemGroup>
</When>
</Choose>
Expand Down
47 changes: 47 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<Project>

<PropertyGroup Label="Core">
<NETStandardImplicitPackageVersion>2.0.3</NETStandardImplicitPackageVersion>
</PropertyGroup>

<ItemGroup Label="System">
<!-- BCL Extensions -->
<PackageVersion Version="7.0.0" Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageVersion Version="1.1.1" Include="Microsoft.Bcl.HashCode" />
<!-- Annotations -->
<PackageVersion Version="5.0.0" Include="System.ComponentModel.Annotations" />
<!-- Memory -->
<PackageVersion Version="4.5.5" Include="System.Memory" />
<!-- Reactive -->
<PackageVersion Version="5.0.0" Include="System.Reactive" />
<!-- Runtime -->
<PackageVersion Version="6.0.0" Include="System.Runtime.CompilerServices.Unsafe" />
<!-- Json -->
<PackageVersion Version="7.0.0" Include="System.Text.Json" />
<!-- Tasks -->
<PackageVersion Version="4.5.4" Include="System.Threading.Tasks.Extensions" />
</ItemGroup>

<ItemGroup Label="Core">
<!-- PolySharp -->
<PackageVersion Version="1.8.1" Include="PolySharp" />
</ItemGroup>

<ItemGroup Label="Global">
<!-- Build Helpers -->
<PackageVersion Version="1.1.1" Include="Microsoft.SourceLink.GitHub" />
<PackageVersion Version="3.5.119" Include="Nerdbank.GitVersioning" />
<PackageVersion Version="1.1.118" Include="StyleCop.Analyzers" />
</ItemGroup>

<ItemGroup Label="Tests">
<!-- MSTest -->
<PackageVersion Version="3.0.1" Include="MSTest.TestAdapter" />
<PackageVersion Version="3.0.1" Include="MSTest.TestFramework" />
<PackageVersion Version="17.4.1" Include="Microsoft.NET.Test.Sdk" />
<!-- MSTest Extensions -->
<PackageVersion Version="5.0.0" Include="Dbs.Signed3.Nito.AsyncEx.Context" />
<PackageVersion Version="1.1.1" Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" />
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Directory.Solution.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<Project>

<PropertyGroup>
<ManagePackageVersionsCentrally>True</ManagePackageVersionsCentrally>
<RestoreUseStaticGraphEvaluation>True</RestoreUseStaticGraphEvaluation>
</PropertyGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@
<!-- .NET Standard 2.0 doesn't have the Span<T> type -->
<When Condition="'$(TargetFramework)' == 'netstandard2.0'">
<ItemGroup>
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Memory" />
</ItemGroup>
</When>

<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
</When>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@

<!-- .NET Standard 2.0 doesn't have the Span<T>, HashCode and ValueTask types -->
<ItemGroup>
<PackageReference Include="Microsoft.Bcl.HashCode" Version="1.1.1" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Threading.Tasks.Extensions" Version="4.5.4" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.HashCode" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Threading.Tasks.Extensions" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
</When>

<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
<When Condition="'$(TargetFramework)' == 'netstandard2.1'">
<ItemGroup>
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>
</When>
</Choose>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" PrivateAssets="All" Pack="false" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="4.0.1" PrivateAssets="All" Pack="false" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.3.1" PrivateAssets="All" Pack="false" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" VersionOverride="4.3.1" PrivateAssets="All" Pack="false" />
</ItemGroup>

</Project>
12 changes: 6 additions & 6 deletions src/CommunityToolkit.Mvvm/CommunityToolkit.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,16 @@

<!-- .NET Standard 2.0 doesn't have the Span<T> and IAsyncEnumerable<T> types -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="System.ComponentModel.Annotations" />
<PackageReference Include="System.Memory" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>

<!-- .NET Standard 2.1 doesn't have the Unsafe type -->
<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.1'">
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" />
<PackageReference Include="System.ComponentModel.Annotations" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" />
</ItemGroup>

<!-- Reference the various multi-targeted versions of the source generator project (one per Roslyn version) -->
Expand Down
2 changes: 1 addition & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<!-- Include PolySharp to generate polyfills for all projects (on their .NET Standard 2.x targets) -->
<ItemGroup>
<PackageReference Include="PolySharp" Version="1.8.1" PrivateAssets="All" IncludeAssets="Analyzers;Build" />
<PackageReference Include="PolySharp" PrivateAssets="All" IncludeAssets="Analyzers;Build" />
</ItemGroup>

<!-- Hook various extension targets at the right place in MSBuild target graph using built-in extension points -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" VersionOverride="4.0.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.3.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" Version="1.1.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" VersionOverride="4.3.1" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing.MSTest" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.0" />
<PackageReference Include="Dbs.Signed3.Nito.AsyncEx.Context" Version="5.0.0" />
<PackageReference Include="System.Reactive" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="Dbs.Signed3.Nito.AsyncEx.Context" />
</ItemGroup>

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

<ItemGroup>
<PackageReference Include="System.Reactive" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="7.0.0" />
<PackageReference Include="Dbs.Signed3.Nito.AsyncEx.Context" Version="5.0.0" />
<PackageReference Include="System.Reactive" />
<PackageReference Include="System.Text.Json" />
<PackageReference Include="Dbs.Signed3.Nito.AsyncEx.Context" />
</ItemGroup>

</Project>
6 changes: 3 additions & 3 deletions tests/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

<!-- MSTest v2 -->
<ItemGroup Condition="'$(IsTestProject)' == 'true'">
<PackageReference Include="MSTest.TestAdapter" Version="3.0.1" />
<PackageReference Include="MSTest.TestFramework" Version="3.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="MSTest.TestAdapter" />
<PackageReference Include="MSTest.TestFramework" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>

</Project>

0 comments on commit a09e743

Please sign in to comment.