Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget install package with wildcard version

Tags:

nuget

How to achieve package reference with wildcard version by using install-package in visual studio 2017? Example line :

PackageReference Include="somePackage" Version="*"

When I try

Install-Package somePackage -Version *

I get error:

Install-Package : Failed to parse the input of Version parameter: * to a valid Semantic version.

like image 960
user656822 Avatar asked Oct 19 '25 06:10

user656822


2 Answers

Unfortunately install-package command does not support a wild card version. But if you have a .NET Core based project then you can use the dotnet.exe add package package_name --version * command from the developer command prompt.

How to check if your project is .NET Core based -

  1. Right click on the project in VS and see if there is an option Edit project_name.csproj

If your project is .NET Core based -

  1. Launch developer command prompt from the start bar
  2. cd project_directory
  3. dotnet add package package_name --version *

Please note that having a * in a package reference is potentially dangerous as it will always get you the latest version which can bring in breaking changes.

like image 53
Ankit Mishra Avatar answered Oct 22 '25 04:10

Ankit Mishra


dotnet add package does not support neither pre-releases nor wildcards, see open issues:

  • https://github.com/nuget/home/issues/4699
  • https://github.com/NuGet/Home/issues/912
like image 34
Honza Krakora Avatar answered Oct 22 '25 05:10

Honza Krakora