NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

[3.5-beta2] Package restore fails to restore "legacy" packages #3208

Closed GeertvanHorrik closed 8 years ago

GeertvanHorrik commented 8 years ago

This feature works great in previous versions of NuGet. Suddenly it stopped working in 3.5-beta2:

So I need 3.5-beta2 to support .net core projects, and I need an older version to support non-.net core projects.

image

harikmenon commented 8 years ago

@rrelyea might be a RTM blocker for 3.5

rrelyea commented 8 years ago

Please give us detailed repro steps. (would be great to be minimal size, if possible).

GeertvanHorrik commented 8 years ago
  1. Clone this public repo: github.com/gittools/GitLink/
  2. Replace tools/NuGet/NuGet.exe with beta 2
  3. In the nuget (the one above) directory of the repository, execute:
nuget.exe restore ..\..\src\GitLink.sln -NoCache -ConfigFile ..\..\src\nuget.config -NonInteractive

Output (even without "NoCache"):

C:\Source\GitLink\tools\NuGet>nuget.exe restore ..\..\src\GitLink.sln -ConfigFile ..\..\src\nuget.config -NonInteractive
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Restoring NuGet package LibGit2Sharp.0.21.0.176.
Restoring NuGet package ImpromptuInterface.6.2.2.
Restoring NuGet package Catel.Core.4.3.0.
Restoring NuGet package LoadAssembliesOnStartup.Fody.1.7.0.
Restoring NuGet package GitTools.Core.1.0.0-unstable0021.
Restoring NuGet package Costura.Fody.1.3.5.
Restoring NuGet package Fody.1.29.3.
Restoring NuGet package Catel.Fody.2.11.0.
WARNING: Unable to find version '0.21.0.176' of package 'LibGit2Sharp'.
  C:\Users\geert\.nuget\packages\: Package 'LibGit2Sharp.0.21.0.176' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'LibGit2Sharp.0.21.0.176' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

Restoring NuGet package ApprovalTests.3.0.8.
WARNING: Unable to find version '1.0.0-unstable0021' of package 'GitTools.Core'.
  C:\Users\geert\.nuget\packages\: Package 'GitTools.Core.1.0.0-unstable0021' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'GitTools.Core.1.0.0-unstable0021' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '2.11.0' of package 'Catel.Fody'.
  C:\Users\geert\.nuget\packages\: Package 'Catel.Fody.2.11.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Catel.Fody.2.11.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '1.7.0' of package 'LoadAssembliesOnStartup.Fody'.
  C:\Users\geert\.nuget\packages\: Package 'LoadAssembliesOnStartup.Fody.1.7.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'LoadAssembliesOnStartup.Fody.1.7.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '6.2.2' of package 'ImpromptuInterface'.
  C:\Users\geert\.nuget\packages\: Package 'ImpromptuInterface.6.2.2' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ImpromptuInterface.6.2.2' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '1.3.5' of package 'Costura.Fody'.
  C:\Users\geert\.nuget\packages\: Package 'Costura.Fody.1.3.5' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Costura.Fody.1.3.5' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '4.3.0' of package 'Catel.Core'.
  C:\Users\geert\.nuget\packages\: Package 'Catel.Core.4.3.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Catel.Core.4.3.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

Restoring NuGet package ApprovalUtilities.3.0.8.
Restoring NuGet package NUnit.2.6.4.
WARNING: Unable to find version '1.29.3' of package 'Fody'.
  C:\Users\geert\.nuget\packages\: Package 'Fody.1.29.3' is not found on source 'C:\Users\geert\.nuget\packages\'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Fody.1.29.3' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.

WARNING: Unable to find version '3.0.8' of package 'ApprovalTests'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ApprovalTests.3.0.8' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
  C:\Users\geert\.nuget\packages\: Package 'ApprovalTests.3.0.8' is not found on source 'C:\Users\geert\.nuget\packages\'.

WARNING: Unable to find version '3.0.8' of package 'ApprovalUtilities'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ApprovalUtilities.3.0.8' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
  C:\Users\geert\.nuget\packages\: Package 'ApprovalUtilities.3.0.8' is not found on source 'C:\Users\geert\.nuget\packages\'.

WARNING: Unable to find version '2.6.4' of package 'NUnit'.
  C:\Users\geert\AppData\Local\NuGet\Cache: Package 'NUnit.2.6.4' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
  C:\Users\geert\.nuget\packages\: Package 'NUnit.2.6.4' is not found on source 'C:\Users\geert\.nuget\packages\'.

Errors in packages.config projects
    Unable to find version '0.21.0.176' of package 'LibGit2Sharp'.
      C:\Users\geert\.nuget\packages\: Package 'LibGit2Sharp.0.21.0.176' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'LibGit2Sharp.0.21.0.176' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '1.0.0-unstable0021' of package 'GitTools.Core'.
      C:\Users\geert\.nuget\packages\: Package 'GitTools.Core.1.0.0-unstable0021' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'GitTools.Core.1.0.0-unstable0021' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '2.11.0' of package 'Catel.Fody'.
      C:\Users\geert\.nuget\packages\: Package 'Catel.Fody.2.11.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Catel.Fody.2.11.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '1.7.0' of package 'LoadAssembliesOnStartup.Fody'.
      C:\Users\geert\.nuget\packages\: Package 'LoadAssembliesOnStartup.Fody.1.7.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'LoadAssembliesOnStartup.Fody.1.7.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '6.2.2' of package 'ImpromptuInterface'.
      C:\Users\geert\.nuget\packages\: Package 'ImpromptuInterface.6.2.2' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ImpromptuInterface.6.2.2' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '1.3.5' of package 'Costura.Fody'.
      C:\Users\geert\.nuget\packages\: Package 'Costura.Fody.1.3.5' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Costura.Fody.1.3.5' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '4.3.0' of package 'Catel.Core'.
      C:\Users\geert\.nuget\packages\: Package 'Catel.Core.4.3.0' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Catel.Core.4.3.0' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '1.29.3' of package 'Fody'.
      C:\Users\geert\.nuget\packages\: Package 'Fody.1.29.3' is not found on source 'C:\Users\geert\.nuget\packages\'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'Fody.1.29.3' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
    Unable to find version '3.0.8' of package 'ApprovalTests'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ApprovalTests.3.0.8' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
      C:\Users\geert\.nuget\packages\: Package 'ApprovalTests.3.0.8' is not found on source 'C:\Users\geert\.nuget\packages\'.
    Unable to find version '3.0.8' of package 'ApprovalUtilities'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'ApprovalUtilities.3.0.8' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
      C:\Users\geert\.nuget\packages\: Package 'ApprovalUtilities.3.0.8' is not found on source 'C:\Users\geert\.nuget\packages\'.
    Unable to find version '2.6.4' of package 'NUnit'.
      C:\Users\geert\AppData\Local\NuGet\Cache: Package 'NUnit.2.6.4' is not found on source 'C:\Users\geert\AppData\Local\NuGet\Cache'.
      C:\Users\geert\.nuget\packages\: Package 'NUnit.2.6.4' is not found on source 'C:\Users\geert\.nuget\packages\'.

NuGet Config files used:
    C:\Source\GitLink\src\nuget.config

Feeds used:
    C:\Users\geert\AppData\Local\NuGet\Cache
    C:\Users\geert\.nuget\packages\

C:\Source\GitLink\tools\NuGet>
GeertvanHorrik commented 8 years ago

Additional testing: without specifying the config, it works (but I have been using this packages.config for years).

rrelyea commented 8 years ago

which setting in the config file is causing this issue?

GeertvanHorrik commented 8 years ago

As it is open source, the setting is located here: https://github.com/GitTools/GitLink/blob/develop/src/nuget.config

<configuration>
  <config>
    <add key="repositoryPath" value="../lib" />
  </config>
</configuration>

If I run NuGet.exe without any config (but for the sln), it still recognizes this config file and then it does work (and correctly uses the ../lib folder).

I think the (machine / user) configs don't merge when explicitly specified?

rrelyea commented 8 years ago

@mishra14 - can you please determine when this changed behavior? broken since 3.4.4, or before?

GeertvanHorrik commented 8 years ago

Latest nightly build (rc1?) seems to work fine for both cases.

mishra14 commented 8 years ago

@rrelyea

I repro'd the error on my machine. I tried a few of the exe's available on nuget.org.

Results -

Build Restore with Config file specified Restore without Config file specified
nuget.exe (v3.5.0-rc1) Errors. As expected (details below). Works fine.
nuget.exe - latest (v3.4.4) Errors. As expected (details below). Works fine.
nuget.exe (v3.5.0-beta2) Errors. As expected (details below). Works fine.
nuget.exe (v3.4.3) Errors. As expected (details below). Works fine.
nuget.exe (v3.3.0) Works fine. Works fine.
nuget.exe (v3.2.0) Works fine. Works fine.
nuget.exe (v2.8.6) Works fine. Errors.

@GeertvanHorrik : The new exe's throw errors on restore when a config file is specified, because if you specify a config file then all the other (default, etc) config files are ignored. you can read more about it on the NuGet Configuration File Docs.

As a reference, you can see the config files used in the console output -

E:\GitLink\tools\NuGet>nuget.exe restore ..\..\src\GitLink.sln -NoCache  -NonInteractive
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
Restoring NuGet package ImpromptuInterface.6.2.2.
... <other restores/adds> ... 

**NuGet Config files used:
    E:\GitLink\src\NuGet.Config
    C:\Users\anmishr\AppData\Roaming\NuGet\NuGet.Config
    C:\ProgramData\nuget\Config\Microsoft.VisualStudio.Offline.config**

Feeds used:
    https://api.nuget.org/v3/index.json
    C:\Users\anmishr\Desktop\MyComponent
    C:\Users\anmishr\Desktop\TestApp-Mongolian
    C:\Users\anmishr\Desktop\TestLib-Tibetan
    C:\Users\anmishr\Desktop\TestLib-Uighur
    C:\Users\anmishr\Desktop\TestLib-Chinese
    C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\

Installed:
    11 package(s) to packages.config projects

But with specified config -

E:\GitLink\tools\NuGet>nuget.exe restore ..\..\src\GitLink.sln -NoCache -ConfigFile ..\..\src\nuget.config -NonInteractive
MSBuild auto-detection: using msbuild version '14.0' from 'C:\Program Files (x86)\MSBuild\14.0\bin'.
... <warnings/restores> ...

Errors in packages.config projects
    Unable to find version '6.2.2' of package 'ImpromptuInterface'.
    Unable to find version '4.3.0' of package 'Catel.Core'.
    Unable to find version '1.7.0' of package 'LoadAssembliesOnStartup.Fody'.
    Unable to find version '1.29.3' of package 'Fody'.
    Unable to find version '0.21.0.176' of package 'LibGit2Sharp'.
    Unable to find version '1.0.0-unstable0021' of package 'GitTools.Core'.
    Unable to find version '1.3.5' of package 'Costura.Fody'.
    Unable to find version '2.11.0' of package 'Catel.Fody'.
    Unable to find version '2.6.4' of package 'NUnit'.
    Unable to find version '3.0.8' of package 'ApprovalUtilities'.
    Unable to find version '3.0.8' of package 'ApprovalTests'.

**NuGet Config files used:
    E:\GitLink\src\nuget.config**

Let us know if this clarifies/fixes the issue.

GeertvanHorrik commented 8 years ago

@mishra14 Thanks for the detailed report Ankit. I will remove the explicit config specifications from all builds (we had to add that for 2.8.6 as you mentioned) to make this work everywhere.

mishra14 commented 8 years ago

@GeertvanHorrik : I have updated the table for v2.8.6 - In that version, specifying the config file works fine.

Also, if this fixes the issue, let us know. We can then close the bug.

GeertvanHorrik commented 8 years ago

Let's assume this breaking change is caused by (v3.4.3). I will update my usages so this one can be closed.

Thanks for all the help.