Unverified Commit f798868d authored by Nick Craver's avatar Nick Craver Committed by GitHub

Centralized package versioning with Directory.Packages.props (#1421)

Explicitly didn't do `/toys` here because the versions aren't shared but if it makes sense: yeah let's add em. This structure is made for easier migration to https://github.com/NuGet/Home/wiki/Centrally-managing-NuGet-package-versions later (we should just need to remove the manual import in each project file (necessary for ordering):
```xml
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Packages.props', '$(MSBuildThisFileDirectory)../'))" />
```

If you're wondering why `Directory.Build.targets` doesn't work - I'm not sure. It's fine for `netcoreapp*` builds, but .NET Full framework throws a fit:
```
C:\git\StackExchange\StackExchange.Redis\tests\NRediSearch.Test\NRediSearch.Test.csproj : error NU1701: Package 'xunit 1.7.0.1540' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v2.1'. This package may not be fully compatible with your project. [C:\git\StackExchange\StackExchange.Redis\Build.csproj]
C:\git\StackExchange\StackExchange.Redis\tests\BasicTestBaseline\BasicTestBaseline.csproj : error NU1604: Project dependency BenchmarkDotNet does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [C:\git\StackExchange\StackExchange.Redis\Build.csproj]
C:\git\StackExchange\StackExchange.Redis\tests\BasicTest\BasicTest.csproj : error NU1604: Project dependency BenchmarkDotNet does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results. [C:\git\StackExchange\StackExchange.Redis\Build.csproj]
C:\git\StackExchange\StackExchange.Redis\tests\BasicTest\BasicTest.csproj : error NU1701: Package 'BenchmarkDotNet 0.5.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target
framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. [C:\git\StackExchange\StackExchange.Redis\Build.csproj]
C:\git\StackExchange\StackExchange.Redis\tests\BasicTestBaseline\BasicTestBaseline.csproj : error NU1701: Package 'BenchmarkDotNet 0.5.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v2.0'. This package may not be fully compatible with your project. [C:\git\StackExchange\StackExchange.Redis\Build.csproj]
```
...but the approach in this PR is both works and is closer to future plans.
parent 782ce11b
......@@ -6,4 +6,20 @@
<ItemGroup>
<EmbeddedFiles Include="$(GeneratedAssemblyInfoFile)"/>
</ItemGroup>
<ItemGroup>
<PackageReference Update="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Update="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Update="Moq" Version="4.13.1" />
<PackageReference Update="NSubstitute" Version="4.2.1" />
<PackageReference Update="Pipelines.Sockets.Unofficial" Version="2.1.6" />
<PackageReference Update="System.Diagnostics.PerformanceCounter" Version="4.7.0" />
<PackageReference Update="System.IO.Compression" Version="4.3.0" />
<PackageReference Update="System.IO.Pipelines" Version="4.7.0" />
<PackageReference Update="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Update="System.Threading.Channels" Version="4.7.0" />
<PackageReference Update="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Update="xunit" Version="2.4.1" />
<PackageReference Update="xunit.runner.visualstudio" Version="2.4.1" />
</ItemGroup>
</Project>
\ No newline at end of file
<Project>
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
<PropertyGroup>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<IsPackable>true</IsPackable>
......
......@@ -13,13 +13,12 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Pipelines.Sockets.Unofficial" Version="2.1.6" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" Version="4.7.0" />
<PackageReference Include="System.IO.Pipelines" Version="4.7.0" />
<PackageReference Include="System.Threading.Channels" Version="4.7.0" />
<!-- net472 needs this for ZipArchive; I have no idea why this changed, but... meh; note this also demands SDK 2.1.400 -->
<PackageReference Include="System.IO.Compression" Version="4.3.0" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="1.1.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
<PackageReference Include="Pipelines.Sockets.Unofficial" />
<PackageReference Include="System.Diagnostics.PerformanceCounter" />
<!-- net472 needs this for ZipArchive; I have no idea why this changed, but... meh -->
<PackageReference Include="System.IO.Compression" Condition="'$(TargetFramework)' == 'net472'" />
<PackageReference Include="System.IO.Pipelines" />
<PackageReference Include="System.Threading.Channels" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -11,7 +11,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet" />
<ProjectReference Include="..\..\src\StackExchange.Redis\StackExchange.Redis.csproj" />
</ItemGroup>
......
......@@ -16,7 +16,7 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="BenchmarkDotNet" Version="0.12.0" />
<PackageReference Include="BenchmarkDotNet" />
<PackageReference Include="StackExchange.Redis" Version="[2.0.558]" />
</ItemGroup>
......
<Project>
<!-- We could delete this file, but being consistent in structure here -->
<Import Project="$(MSBuildThisFileDirectory)..\Directory.Build.props" />
</Project>
......@@ -2,4 +2,5 @@
<PropertyGroup>
<IsTestProject Condition="'$(OS)' != 'Windows_NT' AND $(TargetFramework.StartsWith('net4'))">false</IsTestProject>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.targets', '$(MSBuildThisFileDirectory)../'))" />
</Project>
......@@ -7,6 +7,6 @@
<ItemGroup>
<ProjectReference Include="..\..\src\NRediSearch\NRediSearch.csproj" />
<ProjectReference Include="..\StackExchange.Redis.Tests\StackExchange.Redis.Tests.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
</ItemGroup>
</Project>
\ No newline at end of file
......@@ -16,13 +16,13 @@
<ItemGroup>
<ProjectReference Include="..\..\src\StackExchange.Redis\StackExchange.Redis.csproj" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Moq" Version="4.13.1" />
<PackageReference Include="NSubstitute" Version="4.2.1" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" Version="4.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="Moq" />
<PackageReference Include="Newtonsoft.Json" />
<PackageReference Include="NSubstitute" />
<PackageReference Include="System.Runtime.InteropServices.RuntimeInformation" />
<PackageReference Include="xunit" />
<PackageReference Include="xunit.runner.visualstudio" PrivateAssets="all" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'net462' ">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment