Installing specific version of a package on CLI #39369
Replies: 11 comments 7 replies
-
Unfortunately, it's not possible without the manifest mode. |
Beta Was this translation helpful? Give feedback.
-
You can create an overlay port that selects/installs the version of a port you need without manifest mode. |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks for the responses.
That's unfortunate since this sounds like a basic feature which is present in every other dependency management software I've used. @LilyWangLL I see you've been assigned this issue, do you know what is the ETA for it?
That sounds also quite complex for such a basic task. I just wish to do something like e.g. |
Beta Was this translation helpful? Give feedback.
-
This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 28 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment. |
Beta Was this translation helpful? Give feedback.
-
Pinging this issue to keep it alive. |
Beta Was this translation helpful? Give feedback.
-
There have been relevant discussions before, and based on user needs, vcpkg has added the manifest feature to support users in installing specific versions ports.
Regarding what you mentioned |
Beta Was this translation helpful? Give feedback.
-
If you want to directly use the |
Beta Was this translation helpful? Give feedback.
-
I know. This is a feature request to avoid having additional JSON files, etc. I wish to have a simple CLI way to do it, like any proper dependency manager software has. |
Beta Was this translation helpful? Give feedback.
-
I will convert this issue to discussion. |
Beta Was this translation helpful? Give feedback.
-
As others have said, we do not directly support installing specific versions of a port from the command line. To understand why, there is a bit of history to explain. vcpkg's original design goal was to make it easy to install open-source libraries that "just work" with minimal effort. To accomplish this, our "ports", that is, the build recipes that build the libraries, need to be tested together as part of our continuous integration process. In order for a port to be updated, we have to successfully build it along with any ports that depend on it or it depends on. This creates a sort of contract that if you install any subset of the 2000+ ports in the curated registry, they should "just work" with each other without any version conflicts or other issues. For any given git commit ID in this GitHub repo, we have a listing for each port and the most recent successfully tested version available at that point in time. When you run "vcpkg install LIBRARY_A", you are running vcpkg in "classic mode", which was originally our only mode of operation. This installs the version of the library available in your local copy of the vcpkg repo. You couldn't say "vcpkg install LIBRARY_A@v2" because that violates the design goal of using the current tested version of the library. Since then, we added manifest mode which was a popular request. For professional projects, we strongly recommend using manifests since they offer a number of benefits. We also added more advanced versioning support to support that experience, since professional projects tend to also want control over individual versions. This retains the concept of a versioning baseline but allows you to set additional versioning constraints on top of that. We left classic mode untouched to avoid breaking existing users, some of whom have custom scripts that run vcpkg automatically during their development or CI workflows. We do have some commands for setting up a manifest. For example:
vcpkg new generates new manifest and configuration files. The Once a manifest (vcpkg.json) file exists, you can run this:
This adds the requested libraries to your manifest file. While you can specify which features of a package you want this way, we don't yet support versioning for it, so you'd need to edit the vcpkg.json to add that. This is a good feature request we should consider. To install libraries from the manifest in the current directory, you can run:
Though if you're using MSBuild or CMake I recommend using our special integration for those to automatically have vcpkg get called by your build system before your main project's build starts. In conclusion, I think we could definitely make the user experience better here, especially for simpler projects. I never liked the fracture that we have between classic and manifest mode or the fact that certain vcpkg commands are "classic mode only" even though they appear like they might work in both modes. We're still dealing with some growing pains there as the scope of this project increased. We will consider this issue further. |
Beta Was this translation helpful? Give feedback.
-
For manifest mode, it's often tedious to specify " builtin-baseline", which should be the commit of vcpkg where the version of the specific package matches in |
Beta Was this translation helpful? Give feedback.
-
Hi, I wish to install a specific version of a package using the command line. How can I do this? The only documentation I've found is this link, describing an rather complicated process using manifest mode: https://learn.microsoft.com/en-us/vcpkg/consume/lock-package-versions
Beta Was this translation helpful? Give feedback.
All reactions