visual-studionugetcasablancacpprest-sdk

No CPP REST SDK in NuGet


I have never used nuget before in Visual C++ project. But now I got help on How to use the C Rest SDK NuGet package there.

I have started c++ console project, clicked on "Manage NuGetPackages for solution...":

enter image description here

And got list of packages. Looks like all items are for .NET.

If I type cpprestsdk in search box according manual system founds nothing. Can I use NuGet for Visual C++ projects and why list is missing. How to install cpp REST SDK ?

UPD:

Yes, by mistake it was C# project, but with C++ project picture is the same. Console also not helped:

Type 'get-help NuGet' to see all available NuGet commands.

PM> Install-Package cpprestsdk -Version 2.9.1.1
Attempting to gather dependency information for package 'cpprestsdk.2.9.1.1' with respect to project 'ConsoleApplication1', targeting 'native,Version=v0.0'
Install-Package : Package 'cpprestsdk,2.9.1.1' is not found in the following primary source(s): 'C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\'. Please verify all your online package sources are available (OR) package id, version are specified correctly.
At line:1 char:1
+ Install-Package cpprestsdk -Version 2.9.1.1
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand


PM> Install-Package cpprestsdk
Install-Package : Unable to find package 'cpprestsdk'
At line:1 char:1
+ Install-Package cpprestsdk
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

PM> 

Maybe something wrong with NuGet sources:enter image description here

This is how I search for package:enter image description here


Solution

  • Can I use NuGet for Visual C++ projects?

    Yes, you can use NuGet for Visual C++ projects, according to the document: NuGet for C++, NuGet support for C++ projects since from NuGet 2.5.

    why list is missing. How to install cpp REST SDK?

    Not sure why your list is missing, I have created a sample to install this package, you can check it:

    enter image description here

    Besides, you can also install that package by following the method provided by Matthias in the comment.

    If your list is still missing, you can share us a sample how did you install it.

    Update:

    You need to ensure that you can access the network, I noticed that you are using the packages source "Microsoft Visual Studio Offline Packages", this package source is provided by NuGet when you off-line. So when you install packages you need use the packages source "All" or "nuget.org":

    enter image description here