Visual Studio 2017: Package Restore failed, Rolling back Package changes for 'Projectname' - nuget

Added the new Package using Package Manager console or manage nuget packages in Project it's not added project it's Throw below Error.
I was Check some Links Not give proper reason. why this problem in coming in vs2017
Anyone Know Share the knowledge.
Thanks in Advance

Visual Studio 2017: Package Restore failed, Rolling back Package changes for 'Projectname'
You could not install the package exceldatareader.dataset to the UWP project. That because this package only have the .NET Framework assemblies, which is not compatible with UWP project. You can download that package from nuget.org, then open it, you will find this package only have the assemblies for .NET 2.0 and .NET 4.5:
So this package is not compatible with UWP project, you can find the error message in the output window when you install it to the UWP project:
Hope this helps.

Related

Why is the latest stable version of Newtonsoft showing in Nuget Package Manager as 12.0.3 in one project and as 9.0.1 in another?

In my class library, Manage Nuget Packages shows the latest stable version of Newtonsoft as 12.0.3. In another application that references the class library, Manage Nuget Packages shows the latest stable version of Newtonsoft as 9.0.1
What would explain that difference, and how is it fixed in Visual Studio 2019? When I try to compile the application, it fails with the error that the class library's version of Newtonsoft is newer.
EDIT: I think I've found the reason: in the top right corner of the window the package source for the application was not nuget.org but Visual Studio Offline Sources.
Why is the latest stable version of Newtonsoft showing in Nuget
Package Manager as 12.0.3 in one project and as 9.0.1 in another?
When you install a nuget package, you should select the right nuget package source.
As it shows that, Visual Studio Offline Sources is your local nuget caches. It is required that you download the corresponding nuget version and then exist in this data source. So it depends on you and not all versions of the package are fully displayed.
nuget.org is the ultimate destination for developers releasing nuget packages. You can find every version of the package here. So you should check this link.
Check and enable that link.
Then, open Nuget Package Manager UI and choose nuget.org and you can find it.

Reinstall Nuget Package Manager in Visual Studio 2019

I am facing a problem with my project.
The type or namespace name 'System' could not be found (are you missing a using directive or an assembly reference?
This has happened before and I solved it by reinstalling the Nuget Package Manager using a command. Unfortunately, I am not finding that command again. I tried to find the solution online but everything I am getting is installing/reinstalling NuGet packages and not package manager.
Found this article: https://forums.asp.net/t/1776324.aspx?How+to+install+upgrade+VS+NuGet+Package+Manager+ but It's not applicable here.
NuGet Package Manager is preinstalled in VS2019 and no separate package to download and install. Also, there's not Extension Manage in VS2019 like older versions.
Please Let me know the command to reinstall NuGet Package Manager in Visual Studio 2019.
Such nuget restore issues can normally fix by deleting the obj folder where the nuget files like project.assets.json, projectname.csproj.nuget.g.targets, projectname.csproj.nuget.g.props, projectname.csproj.nuget.dgspec.json and projectnamecsproj.nuget.cache are stored.
If this still doesn't fix it, delete the hidden .vs folder inside the solution, where Visual Studio stores the user settings for the project.

Nuget not restoring packages in visual studio 2015

I installed the Visual Studio 2015 yesterday on my work machine and map a project from TFS that i was working on the previous version (VS 2013). All the projects in this solution are build on top of .NET framework 4.5.1 . When i try to make a Restore Nuget Packages it says that all the packages in the packages.config files are downloaded already, but im getting a lot of compilation errors. The Microsoft.Exchange.WebServices.Data; reference for example, its declared on the packages.config file but im getting the 'red' error on the using clause of this reference in visual studio.
ThereĀ“s other package that the nuget says it is installed but in the references its possible to see an yellow triangle. And this package is on the packages.config too.
Is that something different in this new versio of nuget?
Ps. I already installed the update of the nuget program.

Could not install package 'NuGet.Client 3.2.0'

I'm working with RESTful webservice, getting error while adding package "System.Net.Http";
"The 'System.Net.Http 4.0.0' package requires NuGet client version '3.0' or above, but the current NuGet version is '2.8.5.0'. "
So, to resolve above error i'm trying to install "NuGet client" from "Add Package" option in xamarin studio, but this time I'm facing another issue that is;
"Could not install package 'NuGet.Client 3.2.0'. You are trying to install this package into a project that targets 'portable-net45+win+wp80+MonoAndroid10+xamarinios10+MonoTouch10', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author."
please help to resolve this issue.
Xamarin Studio currently does not support NuGet 3. It is currently only supported in Visual Studio 2015.
It is not possible to upgrade Xamarin Studio so it supports NuGet 3 at this time. Installing the NuGet.Client NuGet package does not upgrade NuGet in Xamarin Studio.
I would instead look at using the Microsoft.Net.Http NuGet package which you can install into a portable class library project (PCL) and supports all Xamarin Android and Xamarin iOS projects.
I was able to grab a copy of System.Net.Http.dll from another project and manually add it as a reference to my Xamarin project. I put it in the packages folder and then browsed to it from the edit references dialog.
For people facing problem trying to add System.Net.Http...
I was able to solve the problem by using Microsoft.Net.Http instead of System.Net.Http. In Xamarin studio, Right click on your project > Add > Add NuGet Packages.. > search for "Microsoft Http Client Libraries" and click Add Package.

How can I add libraries to Xamarin Mono for Android project in VS2010?

I am working on a mono for Android application (my very first) that consumes a web api. In the documentation at xamarin.com there are examples on using different libraries such as RestSharp and Json.Net.
However, when I try to install these libraries via Nuget in my VS2010 project it failes with the following message:
Install failed. Rolling back... Could not install package
'Newtonsoft.Json 4.5.9'. You are trying to install this package into a
project that targets 'MonoAndroid,Version=v2.2', but the package does
not contain any assembly references that are compatible with that
framework. For more information, contact the package author.
How can I include such libraries in my project?
Thanks in advance.
Erwin
This error message indicates those libraries are not compatible with Mono for Android. You should ask the manufacturer of the libraries if they have a MfA compatible version. If you have the source code of the libraries you could also try to make a MfA library, using linked source files, yourself.
Not sure if you've tried this but if you're using xamarin studio and right click the component folder in your Android app project choosing add component should be able to solve your problem. This will add a reference to the component that is added. Components seem like they are mono compatible packages and what's good for your case is that there are components for both RestSharp and Json.Net:
https://components.xamarin.com/view/restsharp
http://components.xamarin.com/view/json.net/