Run Update-Package -Reinstall in Rider

383 Views Asked by At

I need to solve this problem, but I don't use VisualStudio.

The stated solution (on that question, elsewhere, and also from work colleagues) is Update-Package -Reinstall.

But that pre-supposes the existence of PackageManagerConsole ... which AFAIK doesn't exist in Rider (there's an EF management console available, but not (to my knowledge) a more general Nuget one)

How do I:

  • run that command, or the equivalent, in Rider?
  • run that command from a cmd line outside of any IDE (i.e. outside of / without VisualStudio)
1

There are 1 best solutions below

0
Bowman Zhu-MSFT On

This is the official document of the Update-Package command:

Update-Package (Package Manager Console in Visual Studio)

Available only within the NuGet Package Manager Console in Visual Studio on Windows.

Updates a package and its dependencies, or all packages in a project, to a newer version.

And from the comment of the -reinstall argument, you can see:

Reinstall the same version of the original package, but with the latest version of dependencies (subject to version constraints). If this command rolls a dependency back to an earlier version, use Update-Package <dependency_name> to reinstall that one dependency without affecting the dependent package.

so I think the mutual aim feature in nuget.exe should be:

'nuget restore' and 'nuget update'.

restore command (NuGet CLI)

Downloads and installs any packages missing from the packages folder. When used with NuGet 4.0+ and the PackageReference format, generates a .nuget.props file, if needed, in the obj folder. (The file can be omitted from source control.)

update command (NuGet CLI)

Updates all packages in a project (using packages.config) to their latest available versions. It is recommended to run 'restore' before running the update. (To update an individual package, use nuget install without specifying a version number, in which case NuGet installs the latest version.)

The update command also updates assembly references in the project file, provided those references already exist. If an updated package has an added assembly, a new reference is not added. New package dependencies also don't have their assembly references added. To include these operations as part of an update, update the package in Visual Studio using the Package Manager UI or the Package Manager Console.

Remember to configure the nuget command exe to system env variable path.