Visual Studio 2017 Professional- Unable to find package at source - visual-studio

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.

Related

I get NuGet error when trying to install any package

I'm making a Windows form progect in Visual Studio.
When I trying to install any package through console I get error
Install-Package : Unable to find package 'PackageName' at source ''.
I tried both Visual Studio 2013 and Visual Studio 2019.
When I go to Nuget Browse I get error as well. I don't see any packages
According to your description, you can check your package scources under Tools > Options > NuGet Package Manager if you don’t have the correct package sources you can add this “https://api.nuget.org/v3/index.json” such as:
Maybe try to add -source "https://api.nuget.org/v3/index.json" behind?

No option for adding online packages in VS 2017 Community

I am trying to install a few online or external packages into my project using nuget in Visual Studio 2017. I tried the package console and it fails. The problem seems to be that the only package source I have available as an option is "Microsoft Visual Studio Offline". There is no "All" option in the package source drop down at the top of the package console, which I believe I need to see if I am trying to add online packages. I have searched all over the place for what might be a simple answer, but all answers seem to deal with other related matters and not specifically this one. Maybe I didn't type the correct phrase to yield results, but I tried and couldn't find them. What am I missing? A setting? Not the correct license? Thanks.
PM> install-package jquery
install-package : Unable to find package 'jquery'
At line:1 char:1
+ install-package jquery
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
Go to manage NuGet package manager, click to setting gear button.
Then add new package source:
Name: nuget.org
URL: https://api.nuget.org/v3/index.json

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.

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.

C# - Xamarin : installing android.support.design package

i'm trying to install "Install-Package Xamarin.Android.Support.Design" into Xamarin Visual Studio 2015, but after it starts downloading, this error occurs
Install-Package : Unable to find package 'Xamarin.Android.Support.Design'
At line:1 char:1
+ Install-Package Xamarin.Android.Support.Design
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand
i don't understand any of that, what is wrong?
Ensure that you have a proper NuGet source defined. You can go to Tools -> Options -> NuGet Package Manager -> Package Sources to make sure. i.e.: https://api.nuget.org/v3/index.json
Secondly you should double check that your NuGet version is the latest. Go to Tools -> Extensions and Updates and update if you aren't on the latest version.
Finally you could also try to manually download the package from https://www.nuget.org/packages/Xamarin.Android.Support.Design/ and setup a local NuGet repository to ensure that works. Chances are one of the first bullets should fix this.
Source: https://github.com/NuGet/Home/issues/842

Resources