The package source named 'NuGet' is either invalid or not available - visual-studio

I have installed Nuget 1.2 yesterday, and today, while I was trying to install Entity Framework package, I have encountered the following problem in the Package Manager Console:
PM> install-package entityframework
Install-Package : The package source named 'NuGet official package source [https://go.microsoft.com/fwlink/?LinkID=206669]' is either
invalid or not available and thus is currently unreachable.
At line:1 char:16
+ install-package <<<< entityframework
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
I can surft the internet and I don't think anything is preventing Visual Studio to access the internet.

Actually, there was something that was preventing Visual Studio from accessing the internet. Seems like VS had some problems with my proxy server.
So I used a solution that has been introduced in here and everything works fine now.

Same issue happened to my setup. However, i found that VS 2010 uses proxy settings from Internet Explorer. I have removed proxy settings from IE and it was successfully connecting.

To correct this problem permanently, a fix from Microsoft must be used
This is the name of the file KB2581019(VS10SP1-KB2581019-x86.exe)
While this link is active you can download path correction for it.
http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=38654
It's solved!

Related

Visual Studio 15.8.0 Preview 2.0 - MVC - Core 2.1 - Adding SOAP as Connected Service - Version for package dotnet-svcutil could not be resolved

I am working with the following: Visual Studio 15.8.0 Preview 2.0, ASP.NET Web Application, with Target of .NET Core 2.1. I am trying to add a SOAP service as a Connected Service. (I had the same problem with VS 15.7.4, so I thought going to the preview version might find this issue fixed)
I chose Microsoft WCF Web Service Reference Provider.
When I try to add the SOAP service, I get:
Version for package dotnet-svcutil could not be resolved
...
I went the following route without success (mlacouture - mentioned changing nuget.config in directory svcutil_starter to fix the location of the svcutil package, then doing dotnet restore on the Nuget package. With this preview version of VS, the location of svcutil in nuget.config is already correct (C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2017\ENTERPRISE\COMMON7\IDE\EXTENSIONS\MICROSOFT\WCF CONNECTED SERVICE\svcutil\dotnet-svcutil.1.0.0-preview-20406-879.nupkg).
I continue to still get:
C:\Program Files\dotnet\sdk\2.1.300\NuGet.targets(114,5): error : The local source 'C:\Users\medwa163\AppData\Local\Temp\WCFConnectedService\2018_Jun_22_08_01_15\svcutil_starter\dotnet-svcutil.1.0.0-preview-20406-879.nupkg' doesn't exist. [C:\Users\medwa163\AppData\Local\Temp\WCFConnectedService\2018_Jun_22_08_01_15\svcutil_starter\svcutil_starter.csproj]. It definitely does exist.
If I copy the package to the same directory at the Nuget.config, and change Nuget.config to point to it, I get the same error. Cleared the nuget cache and same error.
GitHub Info on Potential Workaround
...
Any insight into this would be greatly appreciated.
I was finally able to find a solution for this.
I temporarily changed the target of the project from .NET Core 2.1 to .NET Core 2.0. Then I was able to add the service.
After that, I changed the target back to .NET Core 2.1 and tested. I was able to call the service successfully.

NuGet issues when installing same package to multiple F# projects in solution

Here's the solution layout:
FSharpNuGetTest (sln)
FirstService (F# 3.1 console project, .NET 4.5/4.5.2)
SecondService (F# 3.1 console project, .NET 4.5/4.5.2)
For the sake of an argument, let's say I want to install TopShelf from NuGet to both of those services. The error happens no matter the library, someone else had very similar issue not that long ago, but it seems I can actually reliably reproduce it.
NuGet Package Manager version: 2.8.60318.734
After opening NuGet package manager console in VS2013.4 Community Edition:
PM> Install-Package Topshelf -ProjectName FirstService
Installing 'Topshelf 3.1.4'.
(... snip - license stuff ...)
Successfully installed 'Topshelf 3.1.4'.
Adding 'Topshelf 3.1.4' to FirstService.
Successfully added 'Topshelf 3.1.4' to FirstService.
Perfect. Now let's try the same thing with the other service:
PM> Install-Package Topshelf -ProjectName SecondService
'Topshelf 3.1.4' already installed.
Adding 'Topshelf 3.1.4' to SecondService.
No exact match found for removing reference 'Topshelf'. Trying case-insensitive search...
Failed to find match for removing reference 'Topshelf'.
Install-Package : Failed to add reference to 'Topshelf'.
At line:1 char:16
+ Install-Package <<<< Topshelf
+ CategoryInfo : NotSpecified: (:) [Install-Package], InvalidOperationException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
Ooops...
I encountered it (again) when
Trying to install XUnit/NUnit to multiple F# test projects in a solution.
Most recently, when trying to install Akka.FSharp to multiple F# projects in a solution.
Any ideas how to fix it...?
It only happened to me with multiple F# projects - never had any issues with C# projects.
My bandaid solution is to copy & paste references from one .fsproj file to another. Update-Package even seems to be working after that operation.
That doesn't change the fact that it's a hack and not how solution management is supposed to work, especially when reinstall is needed - then you have to copy & paste all <Reference> elements from one .fsproj (the one that actually gets everything installed) to every other all over again, because NuGet package installation dies on subsequent projects...
Edit
It seems that brute force might work here - after c.a 4 tries, the package got installed to the second service application (?!).
That makes no sense...
I just hope I won't have to do that on CI server.
It's kind of a half-answer, but here it goes.
As I noted in the edit, brute-forcing seems to work. If it doesn't work the first time, just spamming Install-Package makes it work on the second (or third, or fourth...) try.
Weird...

Nuget "already has a reference to"

Tests.Functional is selected from the Default project: drop down.
PM> install-package nunit
'NUnit 2.6.0.12054' already installed.
Tests.Functional already has a reference to 'NUnit 2.6.0.12054'.
Yet Nunit does not show up in References for Tests.Functional in the Solution Explorer. Tried reloading VS.Net (2010) and updating Nuget.
Am I missing something?
When running the solution under TFS, make sure the $(SolutionDir)\Packages\repositories.config file is checked out for edit.
Try the following:
Uninstall-Package NUnit -Force
Verify the Tests.Functional.csproj file (using notepad) no longer has any Reference to NUnit (if it still does, manually delete them, the project file probably got corrupted somehow).
Then run the following commandl:
Install-Package NUnit
I ran in to a similar issue trying to download the xunit framework when looking at the Entity Framework code. I worked around this by selecting a project to install to xunit to that didn't have the reference already, then just went in to manage and removed the reference to the project that didn't actually need it.
It appears that when a project references an assembly it doesn't have, nuget will see the reference and think that it doesn't need the assembly, even though it does. Simply adding the assembly to another project through nuget solves the issue. Not the most elegant solution, but it works.
Try the following in the Package Manager Console:
Uninstall-Package NUnit -Force
Then, go into your project directory and and manually remove NUnit references from your packages.config & .csproject files if any.
Now you can simply Install using:
Install-Package NUnit

Error in downloading WebActivator with NuGet

I just updated my NuGet Package Manager on my corporate machine. Ever since the update, I am unable to add any package. I tried to install WebActivator for instance and got the following error:
PM> Install-Package WebActivator
Install-Package : The ServicePointManager does not support proxies with the https scheme.
At line:1 char:16
+ Install-Package <<<< WebActivator
+ CategoryInfo : NotSpecified: (:) [Install-Package], NotSupportedException
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PowerShell.Commands.InstallPackageCommand
How can I go about this?
The following work around helped me. Note that I am using Windows 7, Visual Studio 2010 Professional, IE 9 and am behind a corporate proxy. Your steps might vary depending on your environment:
Go to C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE
Open the devenv.exe.config for editing.
In the System.Net node add the code given below.
Close Visual Studio and reopen it.
Check if the RSS feeds are displaying. If yes, everything else including Nuget should also work.
If RSS feeds section is prompting for password, then provide it and save it.
If things don't work still, run fiddler and go through steps 4 to 6 again. (Just running Fiddler in background also helps in some cases. See link below.)
Code to put in devenv.exe.config:
<defaultProxy useDefaultCredentials="true" enabled="true">
<proxy proxyaddress="http://ProxyServer:8080"/>
</defaultProxy>
This is really a hack based upon the following two discussions, but it works.
Cannot connect to any online resource
http://nuget.codeplex.com/discussions/242477
Hope this helps others who have similar issues. But I really wish there is a better way around. Hardcoding the proxy server and port doesn't seem to be a very maintainable solution. Also, there should be an alternative way of using NuGet packages like WebActivator and Nuget.MVC3.
As a backup if your proxy is HTTPS only, you can follow the package download instructions from:
Nuget packages without nuget package manager? and then the installation instructions from:
How to install a Nuget Package .nupkg file locally?.
I'm not behind a corporate proxy, so the error message made absolutely no sense to me. What helped, though, was to replace the default NuGet package source. I did this by:
Going into NuGet settings and adding a new package source pointing to http://nuget.org/api/v2/ (no s in the scheme)
Disabled the default source
Enabled my newly added source
Now, I don't get the error message anymore. Et voilĂ !

Could not create project in Visual Studio 2010

Can any one tell me why this type of error message is prompting when i am creating new project.
The error message is as below.
" Could not load file or assembly .
'Microsoft.VisualStudio.ManagedInterfaces, Version=8.0.0.0, Culture=neutral,PublicKey Token=b03f5f7f11d50a3a' or one of its dependencies.
The system cannot find the file specified."
What should I do to overcome this?
Maybe the "Repair" option on then VS2010 Setup will help. If not you might have to do a complete uninstall/reboot/install cycle.
A quick google search gave me something pointing at the VS SDK - maybe a reinstall of this might help too.
I had same issue after installation SP1. I tried re-install of SP1 with no success.
Get the Microsoft.VisualStudio.ManagedInterfaces.dll(if it is not present in your environment you can download it from here ) and install to global cache. Restart VS2010 and load you project again.

Resources