sdk: dotnet new project can't restore it's dependencies

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>

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 34 (16 by maintainers)

Commits related to this issue

Most upvoted comments

That looks pretty wrong…

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

Install pre-requisites In order to use .NET Core, you need to install the updated version of OpenSSL, from Homebrew. After installing brew, do the following:

brew update brew install openssl brew link --force openssl