Skip to content

Commit

Permalink
Merge PR #16 from nblockchain/wip/cpm
Browse files Browse the repository at this point in the history
Nuget Centralized Package Management:

In order to have version numbers for all projects
in a single file (and this way avoiding the problem
of depending on more than one version for the same
package).
  • Loading branch information
knocte authored Feb 2, 2024
2 parents d566582 + 1308d38 commit e9b735f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
# The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
apt install --yes --no-install-recommends ca-certificates
apt install --yes --no-install-recommends dotnet6
apt install --yes --no-install-recommends dotnet7
- name: Compile the main solution
run: dotnet build
Expand Down
16 changes: 16 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Workaround for Central Package Management taken from
https://github.com/NuGet/Home/issues/11949 and
https://github.com/microsoft/MSBuildSdks/blob/22cee25ad037827b54b75b6ee1c59a5bc75a744f/src/CentralPackageVersions/Sdk/Sdk.targets#L70-L76
TODO: when upgrading to .NET8.0, we can simply use <PackageReference Include="FSharp.Core" VersionOverride="7.0.0" /> for example, and it
just works (example of a project that works today this way: fantomas)
-->
<Project>
<ItemGroup Condition=" '$(EnableCentralPackageVersions)' != 'false' ">
<PackageReference
Update="FSharp.Core"
Condition="'$(MSBuildProjectExtension)' == '.fsproj' And '$(DisableImplicitFSharpCoreReference)' != 'true' And '$(UpdateImplicitFSharpCoreReference)' != 'false'"
IsImplicitlyDefined="true"
/>
</ItemGroup>
</Project>
17 changes: 17 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="StackExchange.Redis" Version="2.0.513" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.3" />
<PackageVersion Include="NUnit" Version="3.9.0" />
<PackageVersion Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageVersion Include="Microsoft.AspNetCore.App" Version="2.1.34" />
<PackageVersion Include="Giraffe" Version="3.1.0" />
<PackageVersion Include="Giraffe.Razor" Version="1.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.WebSockets" Version="2.1.1" />
<PackageVersion Include="TaskBuilder.fs" Version="2.1.0" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion src/FX.Console/FX.Console.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@

<ItemGroup>
<ProjectReference Include="..\FX.Core\FX.Core.fsproj" />
<PackageReference Include="FSharp.Core" Version="6.0.1" />
</ItemGroup>
</Project>
5 changes: 2 additions & 3 deletions src/FX.Core/FX.Core.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
<Compile Include="Exchange.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="FSharp.Core" Version="6.0.1" />
<PackageReference Include="StackExchange.Redis" Version="2.0.513" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="StackExchange.Redis" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>
</Project>
13 changes: 6 additions & 7 deletions src/FX.Tests/FX.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NUnit" Version="3.9.0" />
<PackageReference Include="FSharp.Core" Version="6.0.1" />
<PackageReference Include="NUnit3TestAdapter" Version="3.9.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
<PackageReference Include="StackExchange.Redis" Version="2.0.513" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NUnit" />
<PackageReference Include="NUnit3TestAdapter" />
<PackageReference Include="Microsoft.NET.Test.Sdk" />
<PackageReference Include="StackExchange.Redis" />
<PackageReference Include="Newtonsoft.Json" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Class1.cs" />
Expand Down
10 changes: 5 additions & 5 deletions src/WebSocketApp/WebSocketApp.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
<Compile Include="Middleware\WebSocketMiddleware.fs" />
<Compile Include="Program.fs" />
<None Include="web.config" CopyToOutputDirectory="PreserveNewest" />
<PackageReference Include="Microsoft.AspNetCore.App" Version="2.1.*" />
<PackageReference Include="Giraffe" Version="3.1.0" />
<PackageReference Include="Giraffe.Razor" Version="1.3.*" />
<PackageReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Giraffe" />
<PackageReference Include="Giraffe.Razor" />
<Watch Include="**\*.cshtml" Exclude="bin\**\*" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" Version="2.1.1" />
<PackageReference Include="TaskBuilder.fs" Version="2.1.0" />
<PackageReference Include="Microsoft.AspNetCore.WebSockets" />
<PackageReference Include="TaskBuilder.fs" />
<ProjectReference Include="..\FX.Core\FX.Core.fsproj" />
</ItemGroup>
</Project>

0 comments on commit e9b735f

Please sign in to comment.