Nuget包在Visual Studio中无法正常工作

mar*_*n32 3 .net c# visual-studio-2010 windows-phone-7

我正在使用VS 2010 Express for Windows phone开始编写Windows Phone应用程序.然后我安装了VS 2012,我制作了一个使用RestSharp消耗JSON/REST服务的桌面应用程序.由于缺乏对Express版本插件的支持,我得到了完整的VS 2010 Ultimate并安装了Nuget.当我创建一个win手机库项目,并添加一个RestSharp软件包时,它显示在References中,但是我无法访问它的任何类(并且使用RestSharp以红色加下划线).此外,当我删除它并从添加引用再次添加时,我得到一个不兼容的引用错误窗口:

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.
Run Code Online (Sandbox Code Playgroud)

如果我将目标更改为WP 7.0,也会出现.

有人解决了类似的问题吗?

Pau*_*ney 5

在我的情况下,这是因为项目文件夹中有一个packages.config文件,但解决方案中没有.这就是我无法再次正确添加引用的原因.从物理磁盘中删除此文件,然后重新运行Install-Package命令.它现在应该正确添加.