question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotnet new project can't restore it's dependencies

See original GitHub issue

Steps to reproduce

install the latest dotnet cli (x64 windows). open a console create a directory “helloworld” (e.g. c:\users{yourname}\documents\helloworld - no spaces in path)

dotnet new
dotnet restore

Expected behavior

Restore packages so that dotnet run will run the app

Actual behavior

log  : Restoring packages for C:\Users\shawn\Documents\helloworld\project.json...
error: Unable to load the service index for source https://www.myget.org/F/aspnetvnext/api/v3/index.json.
error:   An error occurred while sending the request.
error:   The server name or address could not be resolved

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-rc2-002416)

Product Information:
 Version:     1.0.0-rc2-002416
 Commit Sha:  37f00f24e9

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

nuget.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageRestore>
    <add key="enabled" value="True" />
    <add key="automatic" value="True" />
  </packageRestore>
  <packageSources>
    <add key="RC2" value="https://www.myget.org/F/aspnetvnext/api/v3/index.json" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="nuget.org" value="https://www.nuget.org/api/v2/" />
  </packageSources>
  <disabledPackageSources>
  </disabledPackageSources>
  <bindingRedirects>
    <add key="skip" value="False" />
  </bindingRedirects>
  <activePackageSource>
    <add key="RC2" value="true" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
  </activePackageSource>
  <apikeys>
    <add key="https://www.nuget.org" value="..." />
    <add key="http://nuget.gw.symbolsource.org/Public/NuGet" value="..." />
  </apikeys>
</configuration>

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:34 (16 by maintainers)

github_iconTop GitHub Comments

8reactions
davidfowlcommented, Apr 16, 2016

That looks pretty wrong…

4reactions
markhubercommented, Apr 16, 2016

@Petermarcu @shawnwildermuth I just got it to work, though I can’t say I definitely understand the cause. Here is my info and theory:

nuget.config

<configuration>
  <packageSources>
    <add key="dotnet-core" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
    <add key="AspNetCI" value="https://www.myget.org/F/aspnetcirelease/api/v3/index.json" />
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
  </packageSources>
</configuration>

Broken (dotnet new generated)

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-rc2-3002416"
    }
  }

Working:

  "dependencies": {
    "Microsoft.NETCore.App": {
      "type": "platform",
      "version": "1.0.0-rc2-*"
    }
  },

In the project.lock.json all of the dependencies in the broken scenario are all referencing rc3. I suspect that something was recently pushed to a myget feed referencing rc3. Something about dotnet restore is potentially not respecting a version lock or something with the way the explicit version is written in project.json. By using the wildcard match, I believe I’m forcing it to respect rc2.

Read more comments on GitHub >

github_iconTop Results From Across the Web

dotnet new project can't restore it's dependencies
To all the dependencies that i have in my project are getting the similar error like this: NU1002 The dependency System.Runtime.Handles 4.0.1 ...
Read more >
dotnet restore command - .NET CLI
Learn how to restore dependencies and project-specific tools with the dotnet restore command.
Read more >
dotnet sdk 2.0.0 - cant restore a dependency - vs ui shows ...
I add a <PackageReference> to Dazinate.Dnn.Cli (version 0.5.0-unstable0007) nuget package which supports net452. In VS - if i expand the project dependencies ......
Read more >
Dotnet restore clean. cs files) Removing information from ...
The dotnet restore command uses NuGet to restore dependencies and project-specific tools specified in the project file. First off we need a ....
Read more >
Dotnet restore vs nuget restore. Share. In my code repo, there
I am trying to restore NuGet packages in my project using the CLI. ... So, it's much better to use dotnet restore, or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found