问题
I have a solution with various projects in it. The packages
folder is in the solution root. Every time my solution is downloaded onto another PC from TFS, Visual Studio runs the package restore automatically, but then complains that the references to the packages are missing. All of them are where they should be in the packages
folder.
Is this a bug with Visual Studio 2015, or am I doing something wrong?
EDIT:
The package dll's are missing from the packages
folder. Only the nuspec files are there. It is as if it didn't even run the restore.
回答1:
Don't include the packages folder in TFS, just make sure that your packages.config's are included and should be 1 for each VS project. The repositories.config ideally should not be checked into source control (but it can be sometimes, see the link) as this is generated locally on build by VS.
I guess that what you have done is tried to check in the packages and TFS has automatically ignored the .dlls but included the .nupkg files and it therefore when downloaded to another machine, NuGet tells VS that it has the dlls but actually it doesn't
Have a read of this https://docs.nuget.org/consume/package-restore and there are a couple of choices depending on your TFS version and NuGet version, but in my case I have decided not to include the packages folder nor the repositories.config and to create the .nuget folder at solution level containing the NuGet.config file and then the .tfignore file also at solution level.
This now means that everytime I update or add a package, only the .csproj and package.config files are included in my Pending Changes
来源:https://stackoverflow.com/questions/34024257/visual-studio-2015-loses-nuget-packages-on-new-installations