GitXplorerGitXplorer
V

directory-packages-props-converter

public
72 stars
1 forks
0 issues

Commits

List of commits on branch master.
Verified
e291576663199d809945e6aa4b5d8b3a4ab83c23

Set up cross-compilation, add Linux targets (#2)

jjustin-sleep committed 10 months ago
Verified
05ccc134824453c1ad5548b73db701e1b36e6911

Updating the `<PackageReference>` is more tolerant towards additional whitespace

VVannevelj committed a year ago
Verified
c4f5bba8b5f098811cfd4e422ea0b199fedb0ee9

Fixed a panic when a range version is used

VVannevelj committed a year ago
Verified
81e8eb6c260a1ec9dccfab88011f052c66bd9a36

log number of packages found

VVannevelj committed a year ago
Verified
76ed90899d2ae40b68f0ce2bf10fa95d3e0a9678

fix documentation

VVannevelj committed a year ago
Verified
652754175124180a7e794cc8b2186543b76cb6cc

changelog as pre-requisite

VVannevelj committed a year ago

README

The README file for this repository.

directory-packages-props-converter

Converts your projects to use Central Package Management. <PackageReference> dependencies have their Version removed in each individual .csproj file. Instead, a Directory.Packages.props file is created in the root folder which contains the version for each separate dependency.

Getting started

Download the binary from the releases.

Mac:

chmod +x ./directory-packages-props-converter
./directory-packages-props-converter .

If your Mac prevents you from running the executable, right-click the executable and select "Open" to override the default block.


Windows:

.\directory-packages-props-converter.exe .

Once you've ran the script, you'll see a new Directory.Packages.props like this:

<Project>
  <PropertyGroup>
    <ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
  </PropertyGroup>

  <ItemGroup>

    <PackageVersion Include="MSTest.TestAdapter" Version="3.0.2" />
    <PackageVersion Include="MSTest.TestFramework" Version="3.0.2" />
    <PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
    <PackageVersion Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
    <PackageVersion Include="Microsoft.CodeAnalysis" Version="4.4.0" />
  
  </ItemGroup>
</Project>

and corresponding .csproj changes like this

<ItemGroup>
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
-    <PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" />
+    <PackageReference Include="MSTest.TestAdapter" />
</ItemGroup>

Notes

  • When multiple versions are detected for a particular dependency, the highest version number is used
  • Supports .csproj and Directory.Build.props files
  • Partial support for version ranges like [1.1.0, 2]: they will be included in Directory.Packages.props but without trying to discover the largest version