【问题标题】:"dotnet restore" fails for Azure DocumentDB emulator sample projectAzure DocumentDB 模拟器示例项目的“dotnet restore”失败
【发布时间】:2023-03-15 12:54:01
【问题描述】:

我只想尝试同一个项目来与几周前发布的 DocumentDB 模拟器的本地实例进行通信。我已经安装了 dotnet core 和 dotnet core CLI。

  1. https://docs.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator下载模拟器
  2. 安装模拟器(不超过几秒钟)
  3. 为模拟器启动了一个浏览器,它现在可以工作了。
  4. 点击链接下载示例dotnet core项目
  5. 解压文件,在 VS2015 中打开并构建。这失败了。

我认为我在 VS2015 中的工具可能已经过时,所以我从 https://www.microsoft.com/net/core#windowsvs2015 安装了名为“.NET Core 1.0.1 tools Preview 2”的最新工具,但无济于事。仍然失败。

从命令行运行dotnet restore会出现与VS2015相同的错误,即:

C:\repos\quickstart-dotnetcore [(unknown)]> dotnet --version
1.0.0-preview2-003131
C:\repos\quickstart-dotnetcore [(unknown)]> dotnet restore
log  : Restoring packages for C:\repos\quickstart-dotnetcore\project.json...
error: Unable to resolve 'Microsoft.Azure.Documents.Client (>= 0.1.0)' for '.NETCoreApp,Version=v1.0'.
log  : Restoring packages for tool 'BundlerMinifier.Core' in C:\repos\quickstart-dotnetcore\project.json...
log  : Restoring packages for tool 'Microsoft.AspNetCore.Razor.Tools' in C:\repos\quickstart-dotnetcore\project.json...
log  : Restoring packages for tool 'Microsoft.AspNetCore.Server.IISIntegration.Tools' in C:\repos\quickstart-dotnetcore\project.json...
log  : Lock file has not changed. Skipping lock file write. Path: C:\repos\quickstart-dotnetcore\project.lock.json
log  : C:\repos\quickstart-dotnetcore\project.json
log  : Restore failed in 1948ms.

Errors in C:\repos\quickstart-dotnetcore\project.json
    Unable to resolve 'Microsoft.Azure.Documents.Client (>= 0.1.0)' for '.NETCoreApp,Version=v1.0'.

用谷歌搜索它会给出带有 NuGet 配置建议的结果,但我不确定这个 Microsoft.Azure.Documents.Client 的实际位置。在什么包源上?目前,如果我查看 VS2015,我正在使用这个包源:https://api.nuget.org/v3/index.json

【问题讨论】:

    标签: visual-studio .net-core azure-cosmosdb


    【解决方案1】:

    project.json,请更新

     "Microsoft.Azure.Documents.Client" : "0.1.0"
    

     "Microsoft.Azure.DocumentDB.Core": "*"
    

    该示例的 DocumentDB .NET Core SDK 包名称不正确。我们正在努力纠正这一点。

    当前/最新版本为1.0.0,但如上指定*,将确保下载最新版本。

    【讨论】:

    • 哇,这太烦人了,但非常感谢!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-15
    • 1970-01-01
    相关资源
    最近更新 更多