I have a Visual Studio (Community 2013) solution with many c# projects on my pc and I've just upgraded to Windows 10 from 7. The project uses .Net Framework 4.0 Client Profile. On win7 everything worked fine, but now one of the projects doesn't seems to load references. There are yellow triangles near the referenced items, what are not items referenced from the same solution (so system and references downloaded by NuGet not loaded).
The Resources is another project in the solution, the others not. When I open the properties tab for a system reference, the Path
field is empty, and so the Resolved
field is False
...
Besides, in the .csproj file everything seems to be ok, there are <HintPath>
nodes where needed, with relative (or absolute, if the reference is on another drive), and correct, existing paths.
Another weird thing: in the Object Browser all of the references are (seemingly) loaded:
So, what should I do:
I also had this problem and it took me some time to figure it out. The problem is that NuGet changed how the packages are restored. The "old way" needed the ".nuget" folder with 3 files (nuget.config, nuget.exe, nuget.targets) and some settings in the project file like:
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('$(SolutionDir)\.nuget\NuGet.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\.nuget\NuGet.targets'))" />
</Target>
This caused the project to be broken.
To fix this, copy the missing directory to the project (get it with an older version of Visual Studio/NuGet or from a co-worker who has it) or just simply delete the aforementioned part from the project file.
For best results, also remove:
<RestorePackages>true</RestorePackages>
and
<Import Project="$(SolutionDir)\.nuget\nuget.targets" />
from the project file!
Find more on the subject here:
http://blog.davidebbo.com/2014/01/the-right-way-to-restore-nuget-packages.html
http://docs.nuget.org/consume/package-restore/migrating-to-automatic-package-restore
https://docs.microsoft.com/en-us/visualstudio/ide/troubleshooting-broken-references
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With