Vcpkg: introducing export command



Vcpkg helps you acquire and build open source libraries on Windows. Since September 2016, the community added more than 200 libraries in the vcpkg catalog and has been contributing actively to the code itself. Vcpkg now supports Visual Studio 2015 and Visual Studio 2017 and can target dynamic or static libraries and platforms like x64, x86 or UWP.

Today we are delighted to announce a new command: vcpkg export. As you told us in our recent survey, there is a need for a command that exports the binaries that you built using vcpkg. The purpose of this new command is to let you share and redistribute the binaries generated using vcpkg with other developers who want to use it in their project. For example, the team responsible for 3rd party library acquisition in an enterprise can use vcpkg to generate a common set of library binaries used by enterprise projects, and then use vcpkg export to share those binaries (including the .h, the .lib and all thing needed to build against these libraries) with internal developers.

The syntax for the new command is:

You have several options for the export format:

  • –zip
  • –7zip
  • –nuget
  • –raw (uncompressed folder)

When you specify a package to export, all its dependencies are also included in the exported archive. This means the exported packages can stand on their own – no additional dependencies are required.

Here are some examples that demonstrate ways you can use vcpkg export.

i. Exporting to nuget

ii. Exporting to 7zip and zip

You can specify more than one of these options to export in multiple formats.

iii. Exporting multiple libraries for multiple architectures

You can export multiple libraries as well as multiple architectures of the same library in the same export file.

Using the exported binaries

i. Visual Studio Project

To consume the binaries you created using vcpkg export command into a Visual Studio project is to use the vcpkg export –nuget option, and then add the .nupkg to your project as every other NuGet package. Other export options (–zip, –7zip, –raw) contain the necessary .targets file, for msbuild integration in more advanced scenarios, inside scripts\buildsystems\msbuild\.

ii. CMake

A CMake toolchain file is included when exporting from vcpkg export. It is in scripts\buildsystems\. To use it, you need to specify the CMAKE_TOOLCHAIN_FILE variable when calling CMake:

Tell us what you think

As always, we really want this project to be your tool. If you need other export formats, just let us know by creating an issue on GitHub or contributing to the code itself!

We have also verified that all the libraries in the vcpkg catalog work with VS 2017, so if you encounter issues when upgrading, do let us know! We hope you enjoy using vcpkg to migrate your project to Visual Studio 2017.pre>


Leave a comment

  • Avatar
    Konstantin G

    Could you please fix your web site so the options which you’ve mentioned actually work?

    Currently they fail with “Contains invalid characters. Only alphanumeric lowercase ASCII characters and dashes are allowed”, because your web server has replaced double dashes with some non-ASCII characters.