Adding System.CommandLine
In order to utilize the System.CommandLine
packages we need to retrieve them from the NuGet repository.
$ git branch addpackage
$ git checkout addpackage
Switched to branch 'addpackage'
$ cd src
$ dotnet add package System.CommandLine
Determining projects to restore...
Writing /var/folders/93/kx1gxqpn0_vc0fwh9vmlvgtr0000gp/T/tmpgDKBcV.tmp
info : Adding PackageReference for package 'System.CommandLine' into project '/Users/iesoftwaredevelper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/system.commandline/index.json
info : OK https://api.nuget.org/v3/registration5-gz-semver2/system.commandline/index.json 226ms
info : GET https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json
info : NotFound https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json 387ms
info : GET https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json
info : CACHE https://api.nuget.org/v3/registration5-gz-semver2/system.commandline/index.json
info : NotFound https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json 690ms
error: There are no stable versions available, 2.0.0-beta1.21216.1 is the best available. Consider adding the --prerelease option
Usage: NuGet.CommandLine.XPlat.dll package add [options]
Options:
-h|--help Show help information
--force-english-output Forces the application to run using an invariant, English-based culture.
--package Id of the package to be added.
--version Version of the package to be added.
-d|--dg-file Path to the dependency graph file to be used to restore preview and compatibility check.
-p|--project Path to the project file.
-f|--framework Frameworks for which the package reference should be added.
-n|--no-restore Do not perform restore preview and compatibility check. The added package reference will be unconditional.
-s|--source Specifies NuGet package sources to use during the restore.
--package-directory Directory to restore packages in.
--interactive Allow the command to block and require manual action for operations like authentication.
--prerelease Allows prerelease packages to be installed.
Note that because there are not any current stable releases that package was not added. This requires us to use the --prerelease option.
$ dotnet add package System.CommandLine --prerelease
Determining projects to restore...
Writing /var/folders/93/kx1gxqpn0_vc0fwh9vmlvgtr0000gp/T/tmpiMAAv6.tmp
info : Adding PackageReference for package 'System.CommandLine' into project '/Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj'.
info : CACHE https://api.nuget.org/v3/registration5-gz-semver2/system.commandline/index.json
info : GET https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json
info : NotFound https://nuget.pkg.github.com/Pomona-ITS/system.commandline/index.json 764ms
info : Restoring packages for /Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj...
info : Package 'System.CommandLine' is compatible with all the specified frameworks in project '/Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj'.
info : PackageReference for package 'System.CommandLine' version '2.0.0-beta1.21216.1' added to file '/Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/obj/project.assets.json
log : Restored /Users/iesoftwaredeveloper/repos/SimpleCmdLine/src/SimpleCmdLine.csproj (in 119 ms).
If we now review the contents of the project file we can see that the packages was added.
<ItemGroup>
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.21216.1" />
</ItemGroup>
You must be logged in to see the comments. Log in now!