Can't downgrade RestSharp - xamarin

Trying to downgrade RestSharp to 105.1.0 from 105.2.3 but can't. Staying with the newest version works fine and installs fine.
Install-Package RestSharp -Version 105.1.0
Attempting to gather dependency information for package 'RestSharp.105.1.0' with respect to project 'project.iOS', targeting 'Xamarin.iOS,Version=v1.0'
Attempting to resolve dependencies for package 'RestSharp.105.1.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RestSharp.105.1.0'
Resolved actions to install package 'RestSharp.105.1.0'
Install failed. Rolling back...
Package 'RestSharp.105.1.0' does not exist in project 'project.iOS'
Package 'RestSharp.105.1.0' does not exist in folder 'C:\Users\....project\packages'
Install-Package : Could not install package 'RestSharp 105.1.0'. You are trying to install this package into a project that targets 'Xamarin.iOS,Version=v1.0', 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.
At line:1 char:1
+ Install-Package RestSharp -Version 105.1.0
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Install-Package RestSharp
Attempting to gather dependency information for package 'RestSharp.105.2.3' with respect to project 'project.iOS', targeting 'Xamarin.iOS,Version=v1.0'
Attempting to resolve dependencies for package 'RestSharp.105.2.3' with DependencyBehavior 'Lowest'
Resolving actions to install package 'RestSharp.105.2.3'
Resolved actions to install package 'RestSharp.105.2.3'
Package 'RestSharp.105.2.3' already exists in folder 'C:\Users\...\project\packages'
Added package 'RestSharp.105.2.3' to 'packages.config'
Successfully installed 'RestSharp 105.2.3' to project.iOS

If you look at the NuGet package, the answer will be very clear.
https://www.nuget.org/packages/RestSharp/105.1.0
Unzip the .nupkg and go to the lib folder
You will see the respective targets allowed here. Notice there is not target for Xamarin.iOS10 or MonoTouch10 anywhere in the 105.1.0 NuGet package.
However if you do the same to
https://www.nuget.org/packages/RestSharp/105.2.3
You will see there are targets for Xamarin.iOS10 and MonoTouch10.

Related

Can't install nugget package I made because package is not found

I created a nugget package that contains 5 dll that I want to use as dependencies for some projects. I created a package source to C:\Users\fernane\Desktop\test via Visual Studio so I can select and install my packages from that directory. The package named test 1.4.0.nupkgis in that folder.
The problem I have is that when I try to install said package (test), I get the following error :
Package 'test 1.4.0' is not found in the following primary source(s): 'C:\Users\fernane\Desktop\test'. Please verify all your online package sources are available (OR) package id, version are specified correctly.
I created the package using Nuget Package Explorer.
ID of the package : test
Version : 1.4.0
My question is the following : Why do I get this error and how can I install my package?
Thank you and have a nice day.
My question is the following : Why do I get this error and how can I install my package?
Make sure you've "all" source selected in Package Manager Console and then try update-package command:
Alternatively, you can install that package via Manage NuGet Package UI, Right click your project->Select Manage NuGet Package->change the Package Source to your local feed->find the pacage, install it:

Update nuget package with option -IgnoreDependencies get error

I could not update the WindowsAzure.Storage NuGet Package with the option -IgnoreDependencies. When I update it with following command in the Package Manager Console, I always get the error:
update-package WindowsAzure.Storage -IgnoreDependencies
The error:
Update-Package : packages
At line:1 char:15
+ update-package <<<< WindowsAzure.Storage -IgnoreDependencies
+ CategoryInfo : NotSpecified: (:) [Update-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.UpdatePackageCommand
Now my workaround is uninstall that package, then install it with the option -IgnoreDependencies. But I have a lot of projects and I need update it frequently. So I want to know the best way to resolve this issue.
Thanks in advance.
Update nuget package with option -IgnoreDependencies get error
I can reproduce this issue on one computer, but I can not reproduce it on another computer. I compared all the differences between them, the final finding is the NuGet Package Manager for Visual Studio version of the difference when you update the nuget package WindowsAzure.Storage with option -IgnoreDependencies.
The version of NuGet Package Manager for Visual Studio on the computer which have the issue is 3.4.4.1321, the version on another one is 3.5.0.1996. So to resolve this issue, please update the nuget package manager to the 3.5.0.1996:
Uninstall the 3.4.4 from Tools->Extensions and Updates->NuGet Package Manager for Visual Studio. Restart the Visual Studio. Then install the 3.5.0.1996 from nuget.org, restart the Visual Studio.
Note: This issue only occurred when you update the nuget package WindowsAzure.Storage from 4.3.0 with -IgnoreDependencies option.

Visual Studio 2017 Professional- Unable to find package at source

I was trying to add package through nuget package manager=> package manager console and from Manage Nuget packages from solution directly. I am trying to install Newtonsoft.Json from Package Manager Like this Install-Package Newtonsoft.Json but unable to find from the source i.e
Name: nuget.org
Source: https://api.nuget.org/v3/index.json
This gives me result like this:
PM> Install-Package Newtonsoft.Json
Install-Package : Unable to find package 'Newtonsoft.Json' at source ''.
At line:1 char:1
+ Install-Package Newtonsoft.Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Time Elapsed: 00:01:30.2571879
I think that the source here is blank. May be because of that it is unable to load packages. I have tried to manage the package manager setting but not been able to connect. My package manager setting is like this:
Despite of having good connection of internet I am not been able to install package. My questions are:
How should I install package?
What am I doing wrong to install package?
Assuming you are using Windows OS
Have you initialised vs 2017 after installation or Have you updated your vs 2017?
If not then please initialized it.
Restart your PC.
Open your project in vs 2017
Check your nuget package manager settings.
Name:nuget.org
Source:api.nuget.org/v3/index.json
Now, run nuget package manager from tools=>Nuget Package Manager=>Package Manager Console and write your install-package command or run Manage nuget package manager for solution from tools=>Nuget Package Manager=>
Hope,it helps you.
Your VS 2017 is probably using some kind of proxy setting which is preventing it from accessing the internet.
To check if VS can access internet try opening any web page from within VS Browser. If you cannot browse then my hunch is correct.
Solve the proxy issue and you should be fine.
Hope it helps.
I resolved this issue by adding nuget.org which was missing in my package source.
Go to Tools>Nuget package manager>Package Sources>
Click Plus sign >
Name: nuget.org
Source : https://api.nuget.org/v3/index.json
Now your Visual studio will be connected to Internet and package will be downloaded successfully.

Is there a way to install a NuGet package without all of its dependencies?

In a Visual Studio 2015 C# project, is there any way to selectively install the components of a NuGet package? (Aside from manually adding references)
Background:
I have been using the Microsoft.CodeAnalysis.CSharp package recently. This package contains several libraries that I need:
Microsoft.CodeAnalysis
Microsoft.CodeAnalysis.CSharp
It also installs many libraries that these are dependent on. For the features I am using, I only need these two:
System.Collections.Immutable
System.Reflection.Metadata
But it also installs many more libraries that I never need:
System.AppContext
System.ComponentModel.Composition
System.Console
System.Diagnostics.FileVersionInfo
System.Diagnostics.StackTrace
System.IO.FileSystem
System.IO.FileSystem.Primatives
System.Numerics
System.Security.Cryptography.Algorithms
System.Security.Cryptography.Encoding
System.Security.Cryptography.Primitives
System.Security.Cryptography.X509Certificates
System.Text.Encoding.CodePages
System.Threading.Thread
System.Xml
System.Xml.Linq
System.Xml.XmlDocument
System.Xml.XPath
Systen.Xml.XPath.XDocument
Is there someway I can check the boxes of the libraries I want when installing the package?
According to the docs , there only -IgnoreDependencies command could help us ignore all dependencies. We could not ignore part of dependencies.
But you could implement your requirement with -IgnoreDependencies, please refer to following steps:
Install the Microsoft.CodeAnalysis.CSharp package without any dependence:
Install-Package Microsoft.CodeAnalysis.CSharp -IgnoreDependencies
Install the dependence package Microsoft.CodeAnalysis. Common package without any dependence:
Install-Package Microsoft.CodeAnalysis.Common -IgnoreDependencies
Install the dependence package System.Collections.Immutable and System.Reflection.Metadata package:
Install-Package System.Collections.Immutable
Install-Package System.Reflection.Metadata
If you do not need to use the dependences of “System.Collections.Immutable”and “System.Reflection.Metadata”, you can also use the same option to ignore dependences.

Unable to Add System.ServiceModel Nuget Package in Xamarin Form PCL Project

I am trying to follow the official xamarin tutorial to make use of WCF Services from a Xamarin Form PCL project (URL /guides/cross-platform/application_fundamentals/web_services/walkthrough_working_with_WCF/ on Xamarin website)
However, at the time of referencing the System.ServiceModel nuget package, I get the following error and the package does NOT get installed:
Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', 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.
I also tried profile 78 without luck (I removed Windows Phone 8.1 as explained here since there is no WCF support).
I tried different profiles for the PCL project as explained here, but without success.
Also, I tried using the Package Management Console and got similar error:
PM> Install-Package -Verbose
cmdlet Install-Package at command pipeline position 1
Supply values for the following parameters:
Id: System.ServiceModel
GET ... OK
Attempting to gather dependency information for package 'System.ServiceModel.1.0.0' with respect to project 'Mobile\MobileCashRegister', targeting '.NETPortable,Version=v4.5,Profile=Profile7'
Attempting to resolve dependencies for package 'System.ServiceModel.1.0.0' with DependencyBehavior 'Lowest'
Resolving actions to install package 'System.ServiceModel.1.0.0'
Resolved actions to install package 'System.ServiceModel.1.0.0'
Install failed. Rolling back...
Package 'System.ServiceModel.1.0.0' does not exist in project 'MobileCashRegister'
Package 'System.ServiceModel.1.0.0' does not exist in folder 'C:\dev\DevCuddlUpSolution\packages'
Install-Package : Could not install package 'System.ServiceModel 1.0.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile7', 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.
At line:1 char:1
+ Install-Package -Verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
How can I know which profile needs to be selected for the System.ServiceModel nuget package to be installed successfully?
Please note I am using Visual Studio 2015 Professional and the latest available Xamarin.
System.ServiceModel 1.0.0 does not contain any assemblies in any lib folders. It just seems to contain NuGet.exe so you will not be able to use it.
It is also not an official Microsoft NuGet package.

Resources