Giter VIP home page Giter VIP logo

centralisedpackageconverter's Introduction

CentralisedPackageConverter

Converts a project to use Centralised Package Management

What does it do?

To convert a large project to centralised package management, you need to:

  • Go through all of the csproj files and copy the references into the centralised Directory.Packages.props file
  • Remove all the versions from the package reference entries in the csproj files.

This can be laborious for large projects, hence this tool.

How do I get it?

You can install the tool by running:

dotnet tool install CentralisedPackageConverter --global

Then just run the tool:

central-pkg-converter /Users/markotway/SomeAwesomeProject

How Does it Work?

Run the command, passing a folder as the only parameter. The tool will scan for all .csproj files within that folder tree, gather up a list of all of the versioned references in the projects, and will then remove the versions from the csproj file, and write the entries to the Directory.Packages.props file.

Command-line Options

  • Root Directory : Root folder to scan for csproj files. Required.
  • -r, --revert : Revert from Centralised Package Management to csproj-based versions.
  • -d, --dry-run : Read-only mode (make no changes on disk).
  • -f : Force changes (don't prompt/check for permission before continuing).
  • -m : Merge changes with existing directory file.
  • -t, --transitive-pinning : Force versions on transitive dependencies (CentralPackageTransitivePinningEnabled=true).
  • -e, --encoding : Encoding of written files, IANA web name (e.g. utf-8, utf-16). Default is picked by .NET implementation.
  • -l, --linewrap : Line wrap style: lf=Unix, crlf=Windows, cr=Mac. Default is system style.
  • -v, --min-version : Pick minimum instead of maximum package version number.
  • -p, --ignore-prerelease : Ignore prerelease versions.
  • -c, --version-comparison : Which NuGet version parts to consider: Default, Version, VersionRelease, VersionReleaseMetadata (enum NuGet.Versioning.VersionComparison).
  • -x, --exclude-dirs, (Default = ^\.|^bin$|^obj$) Exclude directories matching this regular expression (not search pattern!).

Comments

Central Package Management CPM does not support floating versions, such as wildcards or range operators.

Omitted digits will be implicitly added: "8" == "8.0" == "8.0.0".

Incomplete or invalid packages file

The Directory.Packages.props file may be invalid or incomplete:

  • if the versions found in projects are missing, invalid (e.g. floating) or ignored (e.g. prerelease).
  • if conditions on ItemGroup depend on the project file.

In these cases, manual edits or version selection will be necessary.

Credits

Thanks to Thomas Ardal for the suggestion and pointers to get this pushed as a dotnet global command.

centralisedpackageconverter's People

Contributors

webreaper avatar bastianbirke avatar davidwengier avatar belav avatar agsnyder avatar manandre avatar lachlanvelden-agilent avatar thomasardal avatar lech957 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.