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 console' fails to restore nuget packa

See original GitHub issue

Steps to reproduce

D15PreRel 26601.00 Latest CLI 2.0.0 bits. 2.0.0-preview2-006195

Run ‘dotnet new console -n console1’ from an admin cmd prompt.

Expected behavior

Nuget packages are restored during the creation process

Actual behavior

Nuget packages fail to restore. Gives prompt to restore manually

Environment data

dotnet --info output:

c:\Users\v-masche\projects>dotnet --info output
.NET Command Line Tools (2.0.0-preview2-006195)

Product Information:
 Version:            2.0.0-preview2-006195
 Commit SHA-1 hash:  5a47e7db07

Runtime Environment:
 OS Name:     Windows
 OS Version:  6.3.9600
 OS Platform: Windows
 RID:         win81-x64
 Base Path:   C:\Program Files\dotnet\sdk\2.0.0-preview2-006195\

Microsoft .NET Core Shared Framework Host

  Version  : 2.0.0-preview2-25324-03
  Build    : b6c9f8ad69dc3edd601e288198de27975b514306


c:\Users\v-masche\projects>dotnet new console -n console1
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on console1\console1.csproj...
Restore failed.
Output from command:
  Restoring packages for c:\Users\v-masche\projects\console1\console1.csproj...
C:\Program Files\dotnet\sdk\2.0.0-preview2-006195\NuGet.targets(98,5): error : U
nable to resolve 'Microsoft.NETCore.App (>= 2.0.0-preview2-25324-03)' for '.NETC
oreApp,Version=v2.0'. [c:\Users\v-masche\projects\console1\console1.csproj]
  Generating MSBuild file c:\Users\v-masche\projects\console1\obj\console1.cspro
  Generating MSBuild file c:\Users\v-masche\projects\console1\obj\console1.cspro
  Writing lock file to disk. Path: c:\Users\v-masche\projects\console1\obj\proje
  Restore failed in 381.76 ms for c:\Users\v-masche\projects\console1\console1.c

  Errors in c:\Users\v-masche\projects\console1\console1.csproj
      Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0-preview2-25324-03)' for

  NuGet Config files used:
      C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config

  Feeds used:
      C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Post action failed.
Description: Restore NuGet packages required by this project.
Manual instructions: Run 'dotnet restore'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

livarcocccommented, Jun 5, 2017

@mattscheffer this is a known issue that we are working to fix. This happens because our offline cache is out of sync with the runtime, which means that you need a NuGet.Config with this feed in it to be able to restore: <add key="dotnet-core" value="" />.

@dohnuts I would file an issue at nuget/home for this. I don’t believe it is related to this issue here.

livarcocccommented, Jul 28, 2017

No, you can’t. For many reasons actually, but the system is all built to compile against NuGet packages. Also, the assemblies under shared are not reference assemblies, they are rather runtime assemblies.

By now though, this issue should not happen anymore, as the CLI and ASP.NET are in sync.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshooting NuGet Package Restore in Visual Studio
Select the Tools > NuGet Package Manager > Package Manager Settings menu command. · Set both options under Package Restore. · Select OK....
Read more >
How to resolve "NuGet package restore failed" in Visual ...
9 Answers 9 · Click on Tools > Library Package Manager > Package Manager Console · Paste the following lines on the console:...
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. ... Check the console because it may fail to remove...
Read more >
Dotnet restore clean. cs files) Removing information from ...
For example: msbuild <file name>. The folder does not have any spaces in it. The NuGet package restorer used to restore solution packages....
Read more >
Fixing NuGet error: Unable to load the service index for source
Solution 1. Use a NuGet config file. ... To work around this, I am creating a new nuget.config file and populating it with...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found