cpprestsdk icon indicating copy to clipboard operation
cpprestsdk copied to clipboard

Static link NuGet Package, please?

Open Alun-Jones-Kaseya opened this issue 9 years ago • 5 comments

I'm building a custom action for an MSI file, in which I need to verify that a REST API is responding correctly before I allow the install to continue. While I've got this pretty close to working, I'd like to do it beautifully and automatically, in both manual and automated (CI) builds. Best way to do that is if there's a NuGet package I can reference - but there isn't one for the static library version. It seems you're really close now. Any chance we could see this happen, please? I saw lots of requests for this on CodePlex, but this doesn't seem to be an issue you've brought over.

Thanks,

Alun-Jones-Kaseya avatar May 05 '17 20:05 Alun-Jones-Kaseya

I really would like this feature as well. Having to pull source, rebuild, and check in new libs every time we have a new version is a pain. I would gladly contribute this if I knew anything about creating nuget packages.

drearyworlds avatar Feb 05 '18 22:02 drearyworlds

You can easily get static libraries (with static CRT linkage) via

vcpkg install cpprestsdk:x64-windows-static

A NuGet package can then be created (if desired) by using the export command:

vcpkg export --nuget cpprestsdk:x64-windows-static

Edit: added note that the packages are static linked against the CRT

ras0219-msft avatar Feb 05 '18 22:02 ras0219-msft

(Hate to bump, but...) I'd still really like this. I've been fighting with vcpkg and the repo for over an hour, having the nuget package pre-ready to be grabbed for Visual Studio would make this super easy.

csm10495 avatar Apr 09 '19 17:04 csm10495

I also gave up on vcpkg. It seems to make static runtime versions of the DLLs rather than the static LIBs themselves.

drearyworlds avatar Apr 09 '19 22:04 drearyworlds

To get static libraries with dynamic CRT linkage, you can edit the vcpkg triplet files[1] before installing. Specifically, modify triplets/x64-windows.cmake to have:

set(VCPKG_LIBRARY_LINKAGE static)

(instead of the existing set(VCPKG_LIBRARY_LINKAGE dynamic)).

Then, run vcpkg install cpprestsdk:x64-windows and vcpkg export --nuget cpprestsdk:x64-windows. If you already installed any libraries under x64-windows you'll need to remove and reinstall them to use the new settings.

[1] https://github.com/Microsoft/vcpkg/blob/705f9f4919f04f1e59238873ba7a036be64dbde3/docs/users/triplets.md

ras0219-msft avatar Apr 09 '19 23:04 ras0219-msft