When using an IDE such as Visual Studio, it is easy to find out whether newer versions of the NuGet packages used by your project is available, by using the NuGet Package Manager. However, the .NET Core command-line tools do not provide a built-in way for you to report on outdated NuGet packages.
dotnet-outdated is a .NET Core Global tool that allows you to quickly report on any outdated NuGet packages in your .NET Core and .NET Standard projects.
- Specifying the path
- Upgrading Packages
- Working with secure feeds
- Handling pre-release versions
- Locking to the current major or minor release
- Reporting on transitive dependencies
- Failing when updates are available
- Saving results to a file
- Including and excluding packages
Download and install the .NET Core 2.1 SDK or newer. Once installed, run the following command:
dotnet tool install --global dotnet-outdated
If you already have a previous version of dotnet-outdated installed, you can upgrade to the latest version using the following command:
dotnet tool update --global dotnet-outdated
Usage: dotnet outdated [options] <Path> Arguments: Path The path to a .sln, .csproj or .fsproj file, or to a directory containing a .NET Core solution/project. If none is specified, the current directory will be used. Options: --version Show version information -?|-h|--help Show help information -i|--include-auto-references Specifies whether to include auto-referenced packages. -pre|--pre-release <PRERELEASE> Specifies whether to look for pre-release versions of packages. Possible values: Auto (default), Always or Never. -vl|--version-lock <VERSION_LOCK> Specifies whether the package should be locked to the current Major or Minor version. Possible values: None (default), Major or Minor. -t|--transitive Specifies whether it should detect transitive dependencies. -td|--transitive-depth <TRANSITIVE_DEPTH> Defines how many levels deep transitive dependencies should be analyzed. Integer value (default = 1) -u|--upgrade[:<TYPE>] Specifies whether outdated packages should be upgraded. Possible values for <TYPE> is Auto (default) or Prompt. -f|--fail-on-updates Specifies whether it should return a non-zero exit code when updates are found. -inc|--include <FILTER_INCLUDE> Specifies to only look at packages where the name contains the provided string. Culture and case insensitive. If provided multiple times, a single match is enough to include a package. -exc|--exclude <FILTER_EXCLUDE> Specifies to only look at packages where the name does not contain the provided string. Culture and case insensitive. If provided multiple times, a single match is enough to exclude a package. -o|--output <OUTPUT_FILENAME> Specifies the filename for a generated report. (Use the -of|--output-format option to specify the format. JSON by default.) -of|--output-format <OUTPUT_FILE_FORMAT> Specifies the output format for the generated report. Possible values: json (default) or csv.
Specifying the path
You can run dotnet-outdated without specifying the
Path argument. In this case, it will look in the current directory for a solution (
.sln) and if one is found it will analyze that solution. If no solution is found it will look for a project (
.fsproj) and if one is found it will analyze that project. If more than one solution or project is found in the current folder, dotnet-outdated will report an error.
You can also pass a directory in the
Path argument, in which case the same logic described above will be used, but in the directory specified.
Lastly, you can specify the path to a solution (
.sln) or project (
.fsproj) which dotnet-outdated must analyze.
dotnet-outdated can automatically attempt to upgrade any outdated packages to the latest version by passing the
-u|--upgrade option. You can let dotnet-outdated prompt you for each outdated package by using the
Working with secure feeds
dotnet-outdated supports secure NuGet feeds, such as MyGet. It is suggested that you add these to your sources using the source command of the NuGet CLI. For secure feeds, you can either add a pre-authenticated URL or you can specify the username and password for the feed using the
-Password options of the
nuget sources command.
dotnet-outdated supports computer-level, user-level and project-level configuration files.
Issues on macOS
In my testing, I ran into issues on macOS where the location of the user-level configuration file was not detected correctly. If you run into problems where dotnet-outdated does not