'Error installing OpenSSL using VCPKG on Visual Studio code: Error: in triplet x64-windows: Unable to find a valid Visual Studio instance

I am trying to fix the error I'm facing while running a rust program on my VScode as shown in the link below, install openssl and and set the paths using vcpkg by following the post: Error: could not find native static library `ssl`, perhaps an -L flag is missing? on WIndows

According to the answer, I ran the following instructions through visual studio code terminal:

git clone https://github.com/Microsoft/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat

The above codes executed successfully but the code below to install openssl resulted in an error.

.\vcpkg.exe install openssl:x64-windows-static

error:

Error: in triplet x64-windows: Unable to find a valid Visual Studio instance
Could not locate a complete Visual Studio instance

How do I resolve the above error? I have cmake installed and functioning properly but still no luck trying to get vcpkg to install openssl.The paths mentioned in the link answer is also set and I am running all the codes above in the correct directory I made.

Directory where I ran the codes:

C:\Users\Administrator\Desktop\wintun-maindtls\vcpkgfile\vcpkg>


Solution 1:[1]

Install the latest version of the Visual studio installer even if you have visual studio code installed. Check the boxes to install desktop development tools for Linux and windows Check the box to install C++ CMake tools as well Then proceed with the installation.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Aishwarya Menon