Reputation: 23084
The same symptom as Nuget Packages are there but missing References but much simpler use case to duplicate:
Result: all References dll maintained by Nuget showing broken yellow triangle, even after the "Clear All NuGet Cache" and "Update-Package -reinstall
" hack recommended by that thread. Closing & reopening VS & solution won't work, despite that the dll are exactly there, as hinted, after Update-Package -reinstall
.
This is VS2017 version 15.3.5.
UPDATE:
Turns out what "available" was an ".xml
" file, whose extension was not shown normally in File Explorer. I.e., the ".dll
" file is missing and is not restored by Update-Package -reinstall
.
UPDATE2:
The Update-Package -reinstall
is not working because it failed to add reference
(Reference unavailable
). Here is the full log: Update: removed after it is solved, see the history, or check out from https://pastebin.com/1e5axkTm.
As I look at the log, I see,
Package 'NUnit 3.6.1' does not exist in project 'MyProj'
Package 'NUnit 3.6.1' already exists in folder '\Path\To\MySolution\packages'
...
Update-Package : Failed to add reference to 'nunit.framework'.
Reference unavailable.
My interpretation is, because the nunit.framework
DLL in not in TFS, thus it is not available locally for User B (or C, D, etc) who gets the solution from TFS, but Update-Package -reinstall
does not notice and cannot fix the problem. Hence causing more problem down the road -- failed to add reference
(Reference unavailable
).
UPDATE3:
Thanks to @LeoLiu-MSFT & @starianchen-MSFT's help, not including the package folder in Source Control solved the above problem. The "Update-Package -reinstall
" don't have any errors now (in case you need to double-check, https://pastebin.com/e8TpXg2D)
FINAL UPDATE:
Yes, @LeoLiu-MSFT & @starianchen-MSFT, not including the package folder in Source Control is the key! please answer so that I can accept.
The following are caused by an entirely different issue -- All MS VS References broken after project moved.
However, even after above, and use "NuGet Package Restore" to download them, I'm still getting the following:
Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ..\packages\Selenium.WebDriver.ChromeDriver.2.28.0\build\Selenium.WebDriver.ChromeDriver.targets.
- I've checked the page of http://go.microsoft.com/fwlink/?LinkID=322105, the "
Allow NuGet to download missing packages
" and "Automatically check for missing packages during build in Visual Studio
" have already been checked.- I've removed the
packages\Selenium.WebDriver.ChromeDriver.2.28.0
folder several times, and did "NuGet Package Restore" several times as well, but the problem remains.What's the proper fix?
Upvotes: 2
Views: 1821
Reputation: 76996
Broken Nuget Packages References out of the box
According to your error log in the UPDATE2:
Package 'NUnit 3.6.1' does not exist in project 'MyProj'
Package 'NUnit 3.6.1' already exists in folder '\Path\To\MySolution\packages'
It seems that you added the packages folder in source control.
To resolve this issue, you should remove that packages folder from source control. You just need to check the packages.config
(or project.json
) to the source control, when other User B
who gets the solution from TFS, then use the command line Update-Package -reinstall
, VS/NuGet will restore the packages first, then re-install the dll to the project.
Upvotes: 2