'dotnet new console' fails to restore nuget packa
See original GitHub issueSteps 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
Log:
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
j.nuget.g.props.
Generating MSBuild file c:\Users\v-masche\projects\console1\obj\console1.cspro
j.nuget.g.targets.
Writing lock file to disk. Path: c:\Users\v-masche\projects\console1\obj\proje
ct.assets.json
Restore failed in 381.76 ms for c:\Users\v-masche\projects\console1\console1.c
sproj.
Errors in c:\Users\v-masche\projects\console1\console1.csproj
Unable to resolve 'Microsoft.NETCore.App (>= 2.0.0-preview2-25324-03)' for
'.NETCoreApp,Version=v2.0'.
NuGet Config files used:
C:\Users\v-masche\AppData\Roaming\NuGet\NuGet.Config
C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.Offline.config
Feeds used:
https://api.nuget.org/v3/index.json
C:\Users\v-masche\.dotnet\NuGetFallbackFolder
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:
- Created 6 years ago
- Comments:5 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" />
.@dohnuts I would file an issue at nuget/home for this. I don’t believe it is related to this issue here.
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.