简体   繁体   English

使用 vcpkg 与朋友分享您的项目的最佳方式是什么

[英]What is the best way to use vcpkg to share your project with a friend

I have a project which depends on cpprestsdk , tinyxml2 .我有一个依赖于cpprestsdktinyxml2的项目。 I run this project on another computer which has no internet connection, I installed these libraries with vcpkg, I was wondering should I statically link these libraries to my solution or use the new export command and create a nuget package and install it on my friend's computer.我在另一台没有互联网连接的计算机上运行这个项目,我用 vcpkg 安装了这些库,我想知道我应该将这些库静态链接到我的解决方案还是使用新的导出命令并创建一个 nuget 包并将其安装在我朋友的计算机上.

Edit : I want to say that I don't need to run the generated .exe file, I want to take the whole visual studio solution.编辑:我想说我不需要运行生成的 .exe 文件,我想采用整个 Visual Studio 解决方案。

If you want to take the whole VS solution over, the easiest way to get started is to export a NuGet package.如果您想完成整个 VS 解决方案,最简单的入门方法是导出 NuGet 包。

Later on, if you want to update the dependencies or install new ones, you can always transition to a full Vcpkg instance by removing the NuGet package from the solution.稍后,如果您想要更新依赖项或安装新的依赖项,您始终可以通过从解决方案中删除 NuGet 包来过渡到完整的 Vcpkg 实例。

In 2021 it seems like the best way to do this is to use vcpkg manifests .在 2021 年,似乎最好的方法是使用 vcpkg manifests Here's an example vcpkg.json:这是一个示例 vcpkg.json:

{
    "name": "myproject",
    "version-string": "0.0.1",
    "dependencies": [
        "cpprestsdk",
        "tinyxml2"
    ]
}

I would just place the vcpkg.json next to the .sln and enable vcpkg manifests.我只是将 vcpkg.json 放在 .sln 旁边并启用 vcpkg 清单。 I believe other users of the project have to install vcpkg themselves still, but maybe msbuild can bootstrap it.我相信该项目的其他用户仍然必须自己安装 vcpkg,但也许 msbuild 可以引导它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM