Skip to content

Latest commit

 

History

History
204 lines (191 loc) · 17.8 KB

Migrating.md

File metadata and controls

204 lines (191 loc) · 17.8 KB

Migrating from Ookii.CommandLine 2.x / 3.x

Ookii.CommandLine 4.0 and later have a number of breaking changes from version 3.x and earlier versions. This article explains what you need to know to migrate your code to the new version.

Although there are quite a few changes, it's likely your application will not require many modifications unless you used subcommands, heavily customized the usage help format, or used custom argument value conversion.

.Net Framework support

As of version 3.0, .Net Framework 2.0 is no longer supported. You can still target .Net Framework 4.6.1 and later using the .Net Standard 2.0 assembly. If you need to support an older version of .Net, please continue to use version 2.4.

Breaking API changes from version 3.0

Breaking behavior changes from version 3.0

  • By default, both : and = are accepted as argument name/value separators.
  • The default value of ParseOptions.ShowUsageOnError has changed to UsageHelpRequest.SyntaxOnly.
  • Automatic prefix aliases are enabled by default for both argument names and command names.
  • The CommandManager, when using an assembly that is not the calling assembly, will only use public command classes, where before it would also use internal ones. This is to better respect access modifiers, and to make sure generated and reflection-based command managers behave the same.

Breaking API changes from version 2.4

Breaking behavior changes from version 2.4

  • Argument type conversion now defaults to CultureInfo.InvariantCulture, instead of CurrentCulture. This change was made to ensure a consistent parsing experience regardless of the user's regional settings. Only change it if you have a good reason.
  • CommandLineParser automatically adds -Help and -Version arguments by default. If you had arguments with these names, this will not affect you. The -Version argument is not added for subcommands.
  • CommandManager automatically adds a version command by default. If you had a command with this name, this will not affect you.
  • The usage help now includes aliases and default values by default.
  • The default format for showing aliases in the usage help has changed.
  • Usage help uses color output by default (where supported).
  • The LineWrappingTextWriter class does not count virtual terminal sequences as part of the line length by default.