I want to configure packages.config to download the available highest version of a package. How can I do that?
Something like:
<package id="PackageName" version="Highest" ... />
I saw attr "allowedVersions", but it always download the version configured in "version" attr.
Right-click the Packages folder in the project, and select Update. This will update the NuGet package to the latest version. You can double-click the Add packages and choose the specific version.
If you right click the project in question you can select "Manage nuGet Packages" from the menu. After you do that you can click "installed packages" on the left hand side to see the packages that you currently have installed. These are what you are seeing in your "packages. config" file.
packages. config: The targetframework attribute of a dependency specifies the variant of a package to install.
The packages. config file is used in some project types to maintain the list of packages referenced by the project. This allows NuGet to easily restore the project's dependencies when the project is to be transported to a different machine, such as a build server, without all those packages. If used, packages.
How configure packages.config to download the highest version
Just as Ashley and Matt said, it is impossible to do that, because packages.config
only allows a single version of a package to be specified.
The simple workaround is using nuget cli to update that package in the pre-build event:
$(YourNuGetPath)\nuget.exe update "$(ProjectDir)packages.config" -Id "<YourPackageId>"
With this build event, Visual Studio will update that package to the latest version before you build your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With