Nuget Package Restore not working-

J DOE picture J DOE · May 11, 2017 · Viewed 7.2k times · Source

I am trying to run the example C# code in visual studio for square connect:

https://github.com/square/connect-api-examples/tree/master/connect-examples/v2/csharp_payment

When I open the solution all of the references have a yellow triangle with and exclamation point next to them.

I have tried to restore nuget packages on the solution, uninstall and reinstall some and i can't get the triangles to go away. It won't build for me.

Any ideas? Thanks

Answer

ladenedge picture ladenedge · May 11, 2017

There is a target in their project file that can become problematic when projects are moved between systems.

You can fix the problem with two steps:

  1. Remove the entire <Target Name="EnsureNuGetPackageBuildImports" ..> element at the end of the project file, then reload the project.
  2. Execute an Update-Package -Reinstall in your (NuGet) Package Manager Console.

That should set everything right for your system and re-point to the correct versions of the relevant libraries.