Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore failures with mixed projects (PC & PR) & global packages folder and packages folder point to the same location #7692

Open
bitbonk opened this issue Jan 14, 2019 · 2 comments
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Area:Settings NuGet.Config and related issues Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:NuGet.exe NuGet.exe Product:VS.Client Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug
Milestone

Comments

@bitbonk
Copy link

bitbonk commented Jan 14, 2019

I have a solution that contains both project with the new (.NET Core) csproj-Format as well as some classic (WPF) projects and in the solution directory I have the follwoing nuget.config file:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <!-- only needed if TFVC is used to prevent nuget from checking in the packages folder -->
  <solution>
    <add key="disableSourceControlIntegration" value="true" />
  </solution>

  <!-- package feeds that should be set for all users of the project -->
  <packageSources>
    <add key="custom1" value="\\some\fileshare\NuGet" />
    <add key="NuGet" value="https://api.nuget.org/v3/index.json" />
    <add key="TFS Feed" value="https://tfs/tfs/Foo/_packaging/myfeed/nuget/v3/index.json" />
  </packageSources>
  
  <config>
    <clear />
    <add key="globalPackagesFolder" value="packages" />
  </config>  
</configuration>

when I run nuget.exe local -list all I get the following output:

http-cache: C:\Users\Me\AppData\Local\NuGet\v3-cache
global-packages: C:\mysolution\packages
temp: C:\Users\Me\AppData\Local\Temp\NuGetScratch
plugins-cache: C:\Users\Me\AppData\Local\NuGet\plugins-cache

When I run nuget.exe restore all packages are correctly restored to the local packages folder in C:\mysolution\packages.

However when I rightclick the solution in the VS 2017 solution explorer, and to "Rebuild Solution" or "Restore NuGet Packages", only the packages referenced by the classic (WPF) projects are being restored to that local packages folder. All packages that are referenced by the .NET Core projects are restored to the global folder in %userprofile%\.nuget\packages

I am desperately trying to find a decent workflow where I can quickly test and update packages in one solution that are being built in another solution during local development. That's the whole purpose of changing the global packages folder. #7678

NuGet product used: VS UI
NuGet version: 4.9.2.0
dotnet.exe --version: 2.2.102
OS version: Win10 v1809

@bitbonk
Copy link
Author

bitbonk commented Jan 14, 2019

OK, it looks like Visual Studio has a problem if the globalPackagesFolder is the same as the local packages folder used by the old project system. If I change it to another folder

<add key="globalPackagesFolder" value="packages2" />

everything works fine. The packages referenced projects of the new project system are correctly restored to packages2 and the other ones to packages.

@nkolev92
Copy link
Member

@bitbonk The root of the problem is that the directory structure of the packages folder for PC restore and the global packages folder is different.
What we call V2 vs V3.

packageName.packageVersion
vs
packageName\packageVersion\

NuGet should give a better error message though.

@nkolev92 nkolev92 added the Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. label Mar 29, 2019
@nkolev92 nkolev92 changed the title Custom globalPackagesFolder in NuGet.config is ignored by Visual Studio 2017 Restore failures with mixed projects (PC & PR) & global packages folder and packages folder point to the same location Mar 29, 2019
@nkolev92 nkolev92 added Area:Settings NuGet.Config and related issues Area:ErrorHandling warnings and errors/log messages & related error codes. Product:NuGet.exe NuGet.exe Product:VS.Client and removed NuGet.config Product:VS.Client labels Aug 5, 2019
@ghost ghost added the Status:Inactive Icebox issues not updated for a specific long time label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:ErrorHandling warnings and errors/log messages & related error codes. Area:Settings NuGet.Config and related issues Functionality:Restore Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:NuGet.exe NuGet.exe Product:VS.Client Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug
Projects
None yet
Development

No branches or pull requests

5 participants