代码之家  ›  专栏  ›  技术社区  ›  vico

NuGet中没有CPP REST SDK

  •  1
  • vico  · 技术社区  · 7 年前

    我以前从未在Visual C++项目中使用过nuget。但现在我得到了帮助 How to use the C Rest SDK NuGet package there

    我已经启动了c++控制台项目,点击 "Manage NuGetPackages for solution...

    enter image description here

    并得到了包裹清单。看起来所有项目都适用于.NET。

    如果我键入 cpprestsdk 我可以在Visual C++项目中使用NuGet吗?为什么缺少列表。如何安装cpp REST SDK?

    UPD:

    是的,这是错的C项目,但与C++项目的图片是一样的。

    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> 
    

    可能是NuGet来源有问题: enter image description here

    以下是我搜索包的方式: enter image description here

    1 回复  |  直到 7 年前
        1
  •  1
  •   Leo Liu    7 年前

    我可以将NuGet用于Visual C++项目吗?

    是的,根据文档,您可以将NuGet用于Visual C++项目: NuGet for C++

    为什么缺少列表。如何安装cpp REST SDK?

    enter image description here

    如果您的列表仍然缺失,您可以向我们分享一个示例,说明您是如何安装它的。

    更新:

    您需要确保可以访问网络,我注意到您正在使用软件包源“ Microsoft Visual Studio Offline Packages

    enter image description here

    推荐文章