Home: Package 'NameOfPackage' is incompatible with 'all' frameworks in project

Created on 27 Apr 2017  路  22Comments  路  Source: NuGet/Home

_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_

ErrorHandling Customer Sprint Restore Backlog 2 Investigate Bug

Most helpful comment

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

dotnet nuget locals all -c

All 22 comments

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

When I changed the package version from 1.0.0-rc to 1.0.0 it worked.

I changed mine from 1.0.0-alpha to 1.0.0 and it also worked.
But then I bumped the version a few times.
these versions all work: 1.0.0, 1.0.1, and 1.0.2
but anything >= 1.0.3 gives me the same error so I changed the version of my package to 2.0.0 and I still get the error.

This is a real show stopper. Is this a nuget thing or a dotnet cli thing?

I think this is a nuget thing, @emgarten is this dup of https://github.com/NuGet/Home/issues/912?

I think this is a nuget thing, @emgarten is this dup of #912?

Is this project floating? I don't see any mention of that here.

I can repro this with the 2.0 sdk. Sad panda here.

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 was surprised by this error as well. Clearing NuGet cache fixed the problem.

dotnet nuget locals all -c

I have the same issue.

When I try the command dotnet restore MYPROJ.csproj and in the .csproj file I have a wild card for the version(*) I am able to restore the package only using the -s flag (dotnet restore MYPROJ.csproj -s https://api.nuget.org/v3/index.json).

If I am using a specific version then I need the -s flag only for the first time, after that it works just with the restore command.

This happened to me and the following fixed it from @poulad :

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

dotnet nuget locals all -c

dotnet --info:

.NET Core SDK (reflecting any global.json):
Version: 2.1.403
Commit: 04e15494b6

Runtime Environment:
OS Name: Windows
OS Version: 10.0.17763
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.1.403\

Host (useful for support):
Version: 2.1.5
Commit: 290303f510

.NET Core SDKs installed:
2.0.0 [C:\Program Files\dotnet\sdk]
2.1.101 [C:\Program Files\dotnet\sdk]
2.1.104 [C:\Program Files\dotnet\sdk]
2.1.201 [C:\Program Files\dotnet\sdk]
2.1.202 [C:\Program Files\dotnet\sdk]
2.1.300 [C:\Program Files\dotnet\sdk]
2.1.400 [C:\Program Files\dotnet\sdk]
2.1.401 [C:\Program Files\dotnet\sdk]
2.1.402 [C:\Program Files\dotnet\sdk]
2.1.403 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.9 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.2 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

I have the same issue.

$ dotnet nuget locals -c all
$ dotnet restore

then, the error was throw in console:

error: Package '<PackageName>' is incompatible with 'all' frameworks in project '/path/to/project.csproj'.

dotnet --info

.NET Core SDK (reflecting any global.json):
 Version:   2.2.100
 Commit:    b9f2fa0ca8

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  16.04
 OS Platform: Linux
 RID:         ubuntu.16.04-x64
 Base Path:   /usr/share/dotnet/sdk/2.2.100/

Host (useful for support):
  Version: 2.2.0
  Commit:  1249f08fed

Hello I have the same error :

C:Users\gando\gitDemo\nugetpkgExperiment>dotnet add package Newtonsoft.Json
Writing C:Users\gando\AppData\Local\Temp\tmp7660.tmp
info : Ajout de PackageReference pour le package 'Newtonsoft.Json' dans le projet 'C:Users\gando\gitDemo\nugetpkgExperiment\nugetpkgExperiment.csproj'.
log : Restauration des packages pour C:Users\gando\gitDemo\nugetpkgExperiment\nugetpkgExperiment.csproj...
error: Impossible de r茅soudre 'Newtonsoft.Json ' pour '.NETCoreApp,Version=v2.2'.
error: Le package 'Newtonsoft.Json' est incompatible avec les frameworks 'all' dans le projet 'C:Users\gando\gitDemo\nugetpkgExperiment\nugetpkgExperiment.csproj'.

C:Users\gando\gitDemo\nugetpkgExperiment>

SDK .NET Core (refl茅tant tous les global.json)聽:
Version: 2.2.108
Commit: 33ed5b90ce

Environnement d'ex茅cution聽:
OS Name: Windows
OS Version: 10.0.17134
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\2.2.108\

Host (useful for support):
Version: 2.2.6
Commit: 7dac9b1b51

.NET Core SDKs installed:
1.0.0 [C:\Program Files\dotnet\sdk]
2.1.504 [C:\Program Files\dotnet\sdk]
2.1.507 [C:\Program Files\dotnet\sdk]
2.1.701 [C:\Program Files\dotnet\sdk]
2.1.801 [C:\Program Files\dotnet\sdk]
2.2.108 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.All 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 1.0.4 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 1.1.1 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.12 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 2.2.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]

@gandho12 - can you tell us what nugetpkgExperiment.csproj has for TargetFramework or TargetFrameworks properties?

Isn't this essentially the same issue as #4699 ?

Similar issue here. Any update about this?

Same problem, any update regarding this issue?

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

Hello, I am using dotnet core 3.1 and I also encountered this issue while I am using my private feed. Everything works fine if I use Visual Studio in Windows but It does not work with dotnet add package on mac (Clearing nuget cache did not work for me). Here's the a workaround I came up with:

[1] Installed mono and nuget https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools
[2] Updated my csproj file (put PackageReference inside ItemGroup)
[3] then I ran this: "nuget restore MySolution.sln" https://docs.microsoft.com/en-us/nuget/consume-packages/package-restore#restore-using-the-nugetexe-cli
[4] PROFIT!

Just ran into this. Publishing a new package, as 1.0.0-alpha.0, didn't work in VS or cli, so thought, hmm, I'll try 1.0.0-rc1, nope. This exact error about "all". Cleared nuget package cache, viola. Weird. I'm on latest everything at time of writing.

It has few complications depending on Windows and MAC.

  1. It looks our MAC error message is different from Windows one for same problem.
    MAC says has very generic messageerror Package 'Domain' is incompatible with 'all' frameworks in project '/Users/yyyy/Desktop/5162/App/App.csproj'. and most likely it attract more traffic for other issues too that has different problem like 'no compatible' TFM version found.
    But 1 above line is more suitable error: Unable to find package Domain. No packages exist with this id in source(s): Mysource, nuget.org

image

For windows same problem error message is 1 line instead of 2 line and it says error: There are no versions available for the package 'domain'.

  1. If add source folder into nuget.config file of project then everything works fine, otherwise we gets above error.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="nuget" value="https://api.nuget.org/v3/index.json" />
    <add key="local" value="/Users/yyyy/Desktop/5162/Mysource" />
  </packageSources>
</configuration>

dotnet add package Domain
Determining projects to restore...
Writing /var/folders/95/5csf91ld2rn7t4t47562qwhc0000gn/T/tmpFgnV6c.tmp
info : Adding PackageReference for package 'Domain' into project '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : Restoring packages for /Users/yyyy/Desktop/5162/App/App.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/domain/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/domain/index.json 1115ms
info : Package 'Domain' is compatible with all the specified frameworks in project '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : PackageReference for package 'Domain' version '1.0.0' added to file '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /Users/yyyy/Desktop/5162/App/obj/project.assets.json
log : Restored /Users/yyyy/Desktop/5162/App/App.csproj (in 1.79 sec).

  1. Another solution is use 'nuget add source command' which works for MAC but not for Windows though. It doesn't requite nuget.config file as above.

a. MAC works
In parent 5162 folder from terminal
>>nuget add Mysource/Domain.1.0.0.nupkg -Source Mypackages
Above creates actual structured nuget local feed: Mypackages>>domain>>1.0.0
Inside there are extra files
image

dotnet add package Domain -s '../Mypackages'
Determining projects to restore...
Writing /var/folders/95/5csf91ld2rn7t4t47562qwhc0000gn/T/tmp3bUxzp.tmp
info : Adding PackageReference for package 'Domain' into project '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : Restoring packages for /Users/yyyy/Desktop/5162/App/App.csproj...
info : GET https://api.nuget.org/v3-flatcontainer/domain/index.json
info : NotFound https://api.nuget.org/v3-flatcontainer/domain/index.json 494ms
info : Package 'Domain' is compatible with all the specified frameworks in project '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : PackageReference for package 'Domain' version '1.0.0' added to file '/Users/yyyy/Desktop/5162/App/App.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: /Users/yyyy/Desktop/5162/App/obj/project.assets.json
log : Restored /Users/yyyy/Desktop/5162/App/App.csproj (in 1.1 sec).

b. Windows doesn't work
>>nuget add ./Mysource/Domain.1.0.0.nupkg -source Mypackages
image

>> dotnet add package Domain -s "C:\NuGetProj\IssueRepro\Mypackages"
Determining projects to restore...
Writing C:Users\xxxxx\AppData\Local\Temp\tmp8C13.tmp
info : Adding PackageReference for package 'Domain' into project 'C:\NuGetProj\IssueRepro\App\App.csproj'.
info : GET https://api.nuget.org/v3/registration5-gz-semver2/domain/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/domain/index.json 387ms
info : GET https://api.nuget.org/v3/registration5-gz-semver2/domain/index.json
info : NotFound https://api.nuget.org/v3/registration5-gz-semver2/domain/index.json 177ms
error: There are no versions available for the package 'Domain'.

  1. dotnet nuget add source C:\NuGetProj\IssueRepro\Mypackages fixes above 3b problem but adds source into local source list for all repositories.

  2. After debugging through code I just realized this does work if we request specific version without any nuget.config modification nor adding source into local source list. I found the part code code causing this problem and patch is ready, but just in case I'm making sure overall restore process.

>>dotnet add package Domain -s "..\Mypackages" --version 1.0.0
Determining projects to restore...
Writing C:Users\yyyy\AppData\Local\Temp\tmpF661.tmp
info : Adding PackageReference for package 'Domain' into project 'C:\NuGetProj\IssueRepro\App\App.csproj'.
info : Restoring packages for C:\NuGetProj\IssueRepro\App\App.csproj...
info : Package 'Domain' is compatible with all the specified frameworks in project 'C:\NuGetProj\IssueRepro\App\App.csproj'.
info : PackageReference for package 'Domain' version '1.0.0' added to file 'C:\NuGetProj\IssueRepro\App\App.csproj'.
info : Committing restore...
info : Writing assets file to disk. Path: C:\NuGetProj\IssueRepro\App\obj\project.assets.json
log : Restored C:\NuGetProj\IssueRepro\App\App.csproj (in 76 ms).

Also one caveat is both dgSpec and asset files don't keep track of custom feed source was used during restore.
image

Was this page helpful?
0 / 5 - 0 ratings