Jim Aho
Jim Aho

Reputation: 11937

"dotnet restore" fails for Azure DocumentDB emulator sample project

I want to just try out the same project to communicate with a local instance of the DocumentDB emulator released just a few weeks back. I already have dotnet core installed and the dotnet core CLI.

  1. Download the emulator from https://learn.microsoft.com/en-us/azure/documentdb/documentdb-nosql-local-emulator
  2. Install the emulator (takes no more than a few seconds)
  3. A browser is fired up for the emulator, it is now working.
  4. Click on the link to download sample dotnet core project
  5. Extract the files, open in VS2015 and build. This fails.

I thought my tooling in VS2015 might be outdated so I installed the latest tooling from https://www.microsoft.com/net/core#windowsvs2015 named ".NET Core 1.0.1 tools Preview 2" but to no avail. Still fails.

Running dotnet restore from command line gives the same error as VS2015, which is:

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'.

Googling on it gives results with NuGet configuration suggestions, but I'm not sure where this Microsoft.Azure.Documents.Client is actually located. On what package source? Currently i'm using this package source if I look inside VS2015: https://api.nuget.org/v3/index.json

Upvotes: 1

Views: 136

Answers (1)

Rajesh Nagpal
Rajesh Nagpal

Reputation: 1118

In project.json, please update

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

to

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

The sample has an incorrect package name for the DocumentDB .NET Core SDK. We are working to correct that.

The current/latest version is 1.0.0 but if you specify * as above, it will ensure that the latest version is downloaded.

Upvotes: 3

Related Questions