dotnet restore is unable to find common .NET packages since switching to .NET 5.0
See original GitHub issueDescription
I switched from .NET Core 3.1 to .NET 5 and since then the action fails to restore common .Net packages.
Details
Error messages on installing dependencies “dotnet restore Project.sln”. The error does not occur when the command is executed locally. No custom nuget repository is used and the packages should be available.
error NU1101: Unable to find package System.Memory. No packages exist with this id in source(s): github [/home/runner/work/Project/Project.sln]
error NU1101: Unable to find package System.Numerics.Vectors. No packages exist with this id in source(s): github [/home/runner/work/Project/Project.sln]
error NU1101: Unable to find package NETStandard.Library. No packages exist with this id in source(s): github [/home/runner/work/Project/Project.sln]
name: .NET Core
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1.7.2
with:
dotnet-version: 5.0.100
- name: Install dependencies
run: dotnet restore Project.sln
- name: Build
run: dotnet build Project.sln --configuration Release --no-restore
- name: Test
run: dotnet test Project.sln --no-restore --verbosity normal
Issue Analytics
- State:
- Created 3 years ago
- Reactions:11
- Comments:11
Top Results From Across the Web
dotnet restore command - .NET CLI
To restore the dependencies, NuGet needs the feeds where the packages are located. Feeds are usually provided via the nuget.config configuration ...
Read more >Troubleshooting NuGet Package Restore in Visual Studio
This article focuses on common errors when restoring packages and steps to resolve them. Package Restore tries to install all package ...
Read more >NuGet Error NU1102
NET SDK error NETSDK1004, which occurs when the project.assets.json file is not found. NuGet Package Restore. See an overview of how NuGet ...
Read more >NuGet Package Restore
For more information, see PackageReference in project files. .NET Core 2.0 and later dotnet build and dotnet run commands restore packages ...
Read more >Troubleshoot .NET tool usage issues - .NET CLI
Possible reasons for this include: * You misspelled a built-in dotnet command. * You intended to execute a .NET program, but dotnet-xyz does...
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
Adding a NuGet.config is a better way to fix it, e.g.
The details for why it broke and why a nuget.config fixes it are pretty complicated, if you follow the links from this issue to the various ones that got raised in the github actions, .net core, and nuget repositories you can get the whole story.
I think it boiled down to a change in some nuget rule that ended up (sporadically) breaking things for every project that didn’t have an explicit nuget config, and while the nuget change would normally be benign, some detail of the GitHub actions environment meant it caused issues.
Because it was only partially the fault of either project I think neither took responsibility for fixing it, so we all have to be explicit about our nuget sources using a config now 😕