Does Visual Studio Build Tools 2022 have a vcpkg component?

Jayman 40 Reputation points
2024-06-04T11:58:09.68+00:00

Hello!

I’m working on contributing to Descent 3. Specifically, I’m working on improving its build instructions. At the moment, I’m working on the part of the build instructions has the user install any prerequisites. I need to make sure that the user has MSVC, CMake and vcpkg.

For that part of the build instructions, I suggested doing something like this:

  1. Open a regular PowerShell windows (as opposed to a developer one).
  2. Make sure that the required packages are installed:
    	winget install Git.Git Microsoft.VisualStudio.2022.BuildTools
    
  3. Restart PowerShell to make sure that the git command is on your Path
  4. Make sure that the required Visual Studio components are installed:
        Start-Process -Wait -Verb RunAs -FilePath "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\setup.exe" -ArgumentList @(
          'modify',
          '--quiet',
          '--channelId', 'VisualStudio.17.Release',
          '--productId', 'Microsoft.VisualStudio.Product.BuildTools',
          '--add', 'Microsoft.VisualStudio.Workload.VCTools',
          '--add', 'Microsoft.VisualStudio.Component.VC.CMake.Project'
        )
    
  5. If you don’t already have one, create a clone of vcpkg:
        git clone https://github.com/microsoft/vcpkg.git
    
  6. Make sure that the VCPKG_ROOT environment variable is set:
        setx VCPKG_ROOT 'C:\path\to\vcpkg'
    

After I submitted that proposal, the maintainers mentioned that it could be simplified. They said that newer versions of Visual Studio can install vcpkg and set VCPKG_ROOT for you.


Here’s where I ran into a problem. Personally, I don’t use the Visual Studio IDE. Up until now, I’ve been using Visual Studio Build Tools 2022 in order to compile Descent 3 on Windows. I can’t find a vcpkg component in the Visual Studio Build Tools component directory. I can see that there is a Microsoft.VisualStudio.Component.Vcpkg component in the Visual Studio Community component directory, but it doesn’t seem to exist for Build Tools.

From what I can tell, I need to either install the Visual Studio IDE in order to get the vcpkg component, or continue to clone the vcpkg repo and set the VCPKG_ROOT environment variable manually. Does Visual Studio Build Tools 2022 really not have a vcpkg component? It seems wasteful to install an entire IDE just to install a command-line tool.

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,824 questions
0 comments No comments
{count} votes

Accepted answer
  1. Gowtham CP 3,730 Reputation points
    2024-06-04T13:26:52.7233333+00:00

    Hey Jayman,

    Thank you for reaching out on the Microsoft Q&A .

    Visual Studio Build Tools 2022 by itself doesn't include vcpkg, focusing on the essentials for C++ projects.

    The full Visual Studio IDE (like the Enterprise or Community version - starting from version 17.6) has a vcpkg component that simplifies installation and setup, as explained here: https://devblogs.microsoft.com/cppblog/vcpkg-is-now-included-with-visual-studio/

    Since you're on Build Tools only, here's what you can do:

    • Manual vcpkg: Keep your plan of grabbing vcpkg from GitHub and setting the environment variable manually. This gives you control over the version. Refer: https://github.com/microsoft/vcpkg
    • Think about alternatives: See if Descent 3's build system can work with dependency managers like CMake or Conan. They might streamline things without needing vcpkg. You can find more info about these tools here: CMake: https://cmake.org/ Conan: https://github.com/conan-io

    Also, those maintainers suggesting simplification - good point! Not everyone uses the full IDE, so keeping the manual vcpkg steps for Build Tools users is a great idea.

    I hope this helps! If you have any further questions, feel free to ask.

    If the information is useful, please accept the answer and upvote it to assist other community members.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful