SolvedHome Package 'NameOfPackage' is incompatible with 'all' frameworks in project

From @bsmayer on April 26, 2017 21:13

Steps to reproduce

Create a folder named 'Domain'
Create a folder named 'App'

Inside of Domain, run these commands:

dotnet new classlib
dotnet restore
dotnet pack --include-symbols --output '../Nugets'

Inside of App, run these commands:

dotnet new classlib
dotnet restore
dotnet add package Domain -s '../Nugets'

Expected behavior

Reference added in the project

Actual behavior

error: Unable to resolve 'Domain' for '.NETCoreApp,Version=v1.1'.
error: Package 'Domain' is incompatible with 'all' frameworks in project '/{ProjectFolder}/App/App.csproj'.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.1)

Product Information:
Version: 1.0.1
Commit SHA-1 hash: 005db40cd1

Runtime Environment:
OS Name: Mac OS X
OS Version: 10.12
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/1.0.1

Update: Here is all possible scenarios and all broken ones are need fixing. By the way below error messages are different from original user reported one. Check this PR comment#561199237 for details on how error messages evolved over time.

V3 source:
Absolute path:
dotnet add package Domain3 -s C:\NuGetProj\IssueRepro\5127\Mypackages3 -v 1.0.0 works

dotnet add package Domain3 -s C:\NuGetProj\IssueRepro\5127\Mypackages3 error: There are no versions available for the package 'Domain3'.

Relative path:
dotnet add package Domain3 -s ..\Mypackages3 -v 1.0.0 works
dotnet add package Domain3 -s ..\Mypackages3 error: There are no versions available for the package 'Domain3'.

V2 source:
Absolute path:
dotnet add package Domain2 -s C:\NuGetProj\IssueRepro\5127\Mysource2 -v 1.0.0 Works.

dotnet add package Domain2 -s C:\NuGetProj\IssueRepro\5127\Mysource2 error: There are no versions available for the package 'Domain2'.

Relative path:
dotnet add package Domain2 -s ..\Mysource2 -v 1.0.0 error: NU1101: Unable to find package Domain2. No packages exist with this id in source(s): ..\Mysource2, nuget.org
error: Package 'Domain2' is incompatible with 'all' frameworks in project 'C:\NuGetProj\IssueRepro\5127\App2\App2.csproj'.

dotnet add package Domain2 -s ..\Mysource2 error: There are no versions available for the package 'Domain2'.

Copied from original issue: dotnet/cli#6428

25 Answers

✔️Accepted Answer

I was surprised by this error as well. Clearing NuGet cache fixed the problem.

dotnet nuget locals all -c

Other Answers:

This happened to me, and at least in my case the error was a red herring. I was not explicitly setting the version.

dotnet add PROJECT package USDA.NET # error: Package 'USDA.NET' is incompatible with 'all' frameworks in project 'PROJECT'.
dotnet add PROJECT package USDA.NET --version 0.0.1-beta # successful

I can repro this issue

I can reproduce this issue without the --include-symbols option on the pack command. Output from dotnet --info:

.NET Command Line Tools (1.0.3)

Product Information:
 Version:            1.0.3
 Commit SHA-1 hash:  37224c9917

Runtime Environment:
 OS Name:     Mac OS X
 OS Version:  10.12
 OS Platform: Darwin
 RID:         osx.10.12-x64
 Base Path:   /usr/local/share/dotnet/sdk/1.0.3

Same issue, I use .Net Core V 3.1.1.02 (current)