Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Nuget Packages not working correctly in Visual Studio

I am writing a Windows Phone app, at the beggining using VS 2010 Express for windows phone. Then I installed VS 2012 and i made a desktop app which consumed JSON/REST service using RestSharp. Due to lack of support for plugins in Express version, i got full VS 2010 Ultimate and installed Nuget. When I create a win phone library project, and i add a RestSharp package, it shows in References, but i cannot access any of it's classes (and using RestSharp is underlined in red color). Also, when i Remove it and add again from Add Reference i get an Incompatible reference error window:

RestSharp.WindowsPhone, Version=103.2.0.0, Culture=neutral, PublicKeyToken=null" is incompatible with 
Windows Phone 7.1
In order to add it yourself you should to change the project's terget to a compatible framework first.

It also appears if i change the target to WP 7.0.

Has anyone solved similar problem?

like image 611
marcin32 Avatar asked Dec 31 '25 01:12

marcin32


1 Answers

In my case this was because there was a packages.config file in the project folder but not in the solution. This was why I could not add the reference again properly. Delete this file from the physical disk, and re-run your Install-Package command. It should add this correctly now.

like image 52
Paul Devenney Avatar answered Jan 02 '26 16:01

Paul Devenney



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!