Visual Studio/C#: Nuget Unable to connect to remote server - nuget

In MS Visual studio, I'm trying to install Nuget packages into my solution.
When I choose the option "Manage Nuget Packages for Solution" and attempt to install a package, I get the message "Unable to connect to the remote server".
I do have Internet connection so do not understand why I always get this message.
Is anyone aware of some steps that can be taken to rectify this issue?
Thanks

Clearing HTTP_PROXY worked for me.
Let me fix it myself
Important: This section, method, or task contains steps that tell you
how to modify the registry. However, serious problems might occur if
you modify the registry incorrectly. Therefore, make sure that you
follow these steps carefully. For added protection, back up the
registry before you modify it. Then, you can restore the registry if a
problem occurs. For more information about how to back up and restore
the registry, click the following article number to view the article
in the Microsoft Knowledge Base: 322756 How to back up and restore the
registry in Windows
To reset your Internet Explorer proxy settings yourself, follow these
steps:
On Windows XP, click Start, or on Windows Vista or Windows 7, click
, and then click Run. On Windows 8 or Windows 8.1, to access the Run
command, press the Windows logo key Windows logo key + R. Or, swipe
in from the right edge of the screen, and then tap Search (or if you
are using a mouse, point to the upper-right corner of the screen,
move the mouse pointer down, and then click Search). Type Run in
the search box, and then tap or click Run.
In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the
following: reg add
"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v ProxyEnable /t REG_DWORD /d 0 /f
Click OK.
On Windows XP, click Start , or on Windows Vista or Windows 7, click
, and then click Run. On Windows 8 or Windows 8.1, to access the Run
command, press the Windows logo key Windows logo key + R. Or, swipe
in from the right edge of the screen, and then tap Search (or if you
are using a mouse, point to the upper-right corner of the screen,
move the mouse pointer down, and then click Search). Type Run in
the search box, and then tap or click Run.
In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following: reg delete
"HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings"
/v ProxyServer /f
Click OK.
From http://support.microsoft.com/kb/2289942 Thanks #Sandy

Solved. that's because Visual studio is using fiddler http connection.
all you have to do is to open fiddler=> fiddler option => connection => uncheck "act as system proxy on startup".
thats all!

This started happening to me quite randomly today on Visual Studio 2012. A bit simplistic but, after checking if the Nuget site itself was up and trying the Package Manager Console, my solution was to:
Close and reopen Visual Studio
Suddenly it could connect to the Nuget server again and download my much needed packages.

Tools -> Library Package Manager -> Package Manager Settings -> Clear Package Cache
That worked for me

Clearing the Proxy Cache in IE Fixed this for me. Use these two command lines in the command prompt (run as administrator)
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
then
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f
The details can be found at https://support.microsoft.com/en-us/kb/2289942

I solved it on mine by commenting out the
<system.net></system.net>
section from the devenv.exe.config located at
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\devenv.exe.config

Here's how I fixed this issue after none of the suggestions above worked:
Internet Explorer > Tools > Connections > Lan Settings
Uncheck 'Automatically Detect Settings' box. This solved the Nuget Package Manager issue for me. Additionally it fixed another connectivity problem I was having with a VMWare virtual desktop AND... it greatly increased speed in Internet Explorer when trying to connect to secure sites.

I had this issue with VS 2010 package restore even after updating the Nuget Package Manager to the latest and also unselecting all package sources I could. I was getting an error while enabling the Nuget Package Restore option on the solution.
I resolved this by using a different box that didn't have restricted https access to the nuget server. When I used VS 2012 from a different box to enable package restore, it worked fine. I believe it needs to be able to connect to the nuget online server to download the latest nuget.exe used during restore operations. So one option you can use is to perform the Enable Package Restore process from a server that has all the internet access necessary, and then check-in the changes. Once these changes are checked-in, you can then load the solution again from VS 2010 or VS 2012 and use the nuget restore capabilities.
Hope that helps!

Restarted Visual Studio twice solved my problem.
First, I restarted but it did not work. Then, I did almost everything but still didn't work.
Then, restarted again solved my problem.

I had the same symptoms, and apparently visual studio was using some proxy setting set up in IE. It turned out that my problem was one of the following:
My IE had been updated to IE 9, but the update wasn't completed because I hadn't completed the 'update wizard'
Some obscure proxy setting was set up in IE (a remnant of a selenium RC test run)
After completing the update wizard, and clearing all proxy settings, my NuGet package manager was working again.

Had the same issue, it was solution specific, and none of the above worked. I deleted the visual studio solution user options file (.suo) and restarted VS 2013 and now I can update and install packages again.

Finally resolved. I disabled an extension in Chrome. I had installed it to hide my real location.

To reset your Internet Explorer proxy settings yourself, follow these steps:1.On Windows XP, click Start, or on Windows Vista or Windows 7, click
2459687, and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key
Windows logo key+ R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run.
2.In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following:
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 0 /f
3.Click OK.
4.On Windows XP, click Start , or on Windows Vista or Windows 7, click
2459687, and then click Run. On Windows 8 or Windows 8.1, to access the Run command, press the Windows logo key
Windows logo key + R. Or, swipe in from the right edge of the screen, and then tap Search (or if you are using a mouse, point to the upper-right corner of the screen, move the mouse pointer down, and then click Search). Type Run in the search box, and then tap or click Run.
5.In the Run text box, copy (CTRL+C) and paste (CTRL+V) or type the following:
reg delete "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /f
6.Click OK.

i could not install globalize in V.S. 2015 and after trying all the answers i tried this. I opened my project in V.S. 2013 and it worked 1st time. hope this helps somebody else

Modem re-start fixed my problem.!

In my case(visual studio 2012-windows10 OS) the problem was with security protocols. Only TLS 1.2 was the enabled protocol and TLS1.1 and TLS1.0 was disabled for some reason. So going into registry and making changes to enable TLS1.0 and TLS1.1 solved the problem.
To enable these protocols you can follow directions on here

I fixed it by uninstall the system proxifier : WideCap

That happened to me when I tried to use Visual Studio from home being connected via public WiFi and my work station was configured to block connections in/out from Internet to VS2017. Check you local firewall setting and ensure that you have Allow for VS2017 when on Public network. (in Windows Defender Firewall & Advanced Security)

nugget.org was blocked in my network for security reason so all the nugget packages are installed from Artifactory via JFrog. After configuring my nugget package manager setting to the link provided by my employer the problem is resolved.

One route that I haven't seen people mentioning is setting the proxy for Nuget in your user folder.
Browse to C:\Users[yourProfile]\AppData\Roaming\Nuget and change your Nuget.config file to the following:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<config>
<add key="http proxy" value="http://yourProxy.yourCompany.org"/>
</config>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>
We set this setting and then Nuget immediately worked.
Ok, but now I get a credentials prompt!
If you also end up getting a credentials prompt when trying to load packages from Nuget in Visual Studio, you should try to manually browse to http://www.nuget.org/downloads. I've seen proxies like BlueCoat display a Content Filter Warning the first time someone visits a site, and since you can download content from Nuget, it get's flagged.
So you may need to browse there one time to click 'Accept Terms', and then you'll be able to access it.

If you are using a developer server, sometimes the TLS is not active. Reach with regedit.exe the following path of register, and if not present, add the following keys. Reboot and try again nuget online from visual studio.
To enable TLS 1.2 support in Windows Schannel
From Notepad.exe, create a text file named tls12-enable.reg.
Copy, and then paste the following text.
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2]
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Client]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SecurityProviders\SCHANNEL\Protocols\TLS 1.2\Server]
"DisabledByDefault"=dword:00000000
"Enabled"=dword:00000001
Save the tls12-enable.reg file.
Double-click the tls12-enable.reg file.
Click Yes to update your Windows Registry with these changes.
Restart your computer for the change to take effect.

Internet Properties -> LAN Settings -> uncheck "Automatically detect settings"

Steps:
Close Fiddler.
Restart Visual Studio.

Related

Why Visual Studio code and most of the applications are not installing in fresh windows 10?

I am trying to install Visual Studio Code in my fresh windows 10 but it is throwing an error Setup was unable to create a directory
Error 5: Access is denied
Since your UAC(User Account Control) is turned off, and you are running the install as Admin (because you already are admin), it seems like a permission issue and not a UAC issue. Try this:
Create a folder name "Temp" under C:\ // This step is important, the
folder has to exist.
Right click the Computer in Start menu and select Properties. Click
Advanced System Setting. In System Properties windows, click
Advanced tab.
Click Environment Variables button. Under User
variables list, double click TMP.
Change Variable value: from
"%USERPROFILE%\AppData\Local\Temp" to "C:\Temp".
Try to install.

How to update VS Code on Windows?

I have VS Code version 1.37.1 and I want to update to the current available version 1.43. My OS is Windows 10.
How can I update the current version to the latest?. Like in Eclipse, check for updates is not updating the installation, rather it gives me a zip.
VS Code will automatically update itself on windows 10. If you'd like to force an update check there's an option available for that under 'Help > Check for Updates'.
If the update still doesn't complete, you can run the installer from here as described in the official Visual Studio Code Documentation under Docs » Supporting » Howtoupdate, found here.
If Update:Mode in VS Code's setting is on 'none' , 'Check for Updates ...' option will disappear from Help. Just be sure it's not on 'none' then you can check for updates.
2021-12-15, if you don't see Check for Updates... then Settings
Make sure it's not none
Then Help, Check for updates..., it won't auto-install. Once it downloads the update, either Help, Install update, or
Normally you don't need to do anything. The default configuration auto-updates and tells you it needs a restart.
If you experience different behaviour then either someone has interfered with settings in VS Code or the platform (Win/Lin/Osx) is misconfigured.
Type Ctrl+, or your platform equivalent and then filter for "update", then inspect your settings to see what may be mucked up. You can also force an update in the Help menu, and if this results in the download of a zip file it's not VS Code that's messed up, it's your platform.
Running this from the command prompt seemed to work for me:
winget upgrade --id Microsoft.VisualStudioCode
I think because I was running vscode as administrator I did not see the Help->Check for updates menu item.
My problem was that I had VS Code open as Administrator. After closing it and opening it normally I got the update to appear once again under the settings icon and in the Help menu.
If you cannot do that you can trigger the update with this command written in the terminal:
winget upgrade --id Microsoft.VisualStudioCode
My problem was with a later version, where update options did not appear under the Help menu. This may be because I ran a user install on a Win 2022 VM where I am Administrator user.
The above solutions did not work but I was able to resolve by running the latest user installer over the existing install (turns out the user install of VS Code does not appear in Control Panel, Uninstall program listing.) Currently this can be downloaded from https://code.visualstudio.com/.
If your update settings are OK, then there is one other possibility. Normally, you would have installed this huge piece of bloatware for your own user account only, using the "VSCodeUserSetup-.exe" installer.
But there is also a "system installer" which installs VSCode into "C:\Program Files" (configuration is still kept per-user). If you installed "VSCodeSetup-.exe" (note: no "User" in the installer file name), then you have an administrative install and will not get full auto-updates, AFAIK.

GitHub clone to desktop uses TortoiseGit instead of GitHub Desktop

When i try to clone a repository to desktop the default app for cloning has suddenly became TortoiseGit instead of GitHub. Anyone with a fix?
The following fix is a permanent solution for this issue that also withstands TortoisGit-updates/repairs.
It adds GitHubDesktop's protocol-associations the way described in https://learn.microsoft.com/en-us/windows/win32/shell/default-programs.
Add to the registry (You can save this content as .reg file and double-click it to auto-import these keys into registry):
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Reboot or on a windows-server sign-out and log-in.
The next time a project is cloned from github, a message-box popped-up asking to pick an app.
GitHubDesktop will now also be available in the Windows settings: Choose default apps by protocol. So it can be recovered with Windows settings, if TortoisGit (or another app) was chosen as default handler for GitHub-clone.
I also opened a new error at GitHubDesktop-development: https://github.com/desktop/desktop/issues/8258
There was a bug in 2.6.0 which made TortoiseGit the default if the github handler was enabled on installation.
To fix this, go to the default programs settings in Windows, open the file-type associations dialog and set github-windows and x-github-client back to the official github client. Maybe you have to update to TortoiseGit 2.7.0 first.
cf. https://www.thewindowsclub.com/change-file-associations-windows
You could try whether the hard way works: (Store this as a .reg file and import it, you need to madjust the paths)
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\github-windows]
[HKEY_CLASSES_ROOT\github-windows]
"URL Protocol"=""
#="URL:github-windows"
[HKEY_CLASSES_ROOT\github-windows\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
[-HKEY_CLASSES_ROOT\x-github-client]
[HKEY_CLASSES_ROOT\x-github-client]
"URL Protocol"=""
#="URL:x-github-client"
[HKEY_CLASSES_ROOT\x-github-client\shell\open\command]
#="\"C:\\Users\\USERNAME\\AppData\\Local\\GitHubDesktop\\app-1.4.2\\GitHubDesktop.exe\" --protocol-launcher \"%1\""
change windows registry is not working.
I have met the same problem and the registry is all right,but github desktop wont come out.
As a software developer,I used url protocol once.I cannt understand why Windows setting is not related to the ROOT registry . I would appreciate a comment.
here is how i solve the problem:
After uninstall tortoise and reinstall github. Chrome works fine.
When you install tortoise,be careful with this setting:
but even if you unchecked this,x-github-client is registed to tortoisegit client again.
You can check it in your windows setting of default apps - choose default apps by protocal.
So i think this is a bug for tortisegit.
I use tortoisegit 2.7.0 and win10 1809.
If you really want github desktop to popup , you should not install tortoisegit
This is based on tobias.loew answer:
If you don't have this line at the start:
Windows Registry Editor Version 5.00
Script won't compile
Create github.reg file:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities]
[HKEY_LOCAL_MACHINE\SOFTWARE\GitHubDesktop\Capabilities\UrlAssociations]
"github-windows"="github-windows"
"x-github-client"="x-github-client"
[HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications]
"GitHubDesktop"="Software\\GitHubDesktop\\Capabilities"
Put this in a file called github.reg and then double click it.

why copy with drag and drop not working in vscode

I updated my vscode and they mentioned the point on their release notes for March 2017.
Copy with drag and drop - Choose whether to copy or cut when you drag and drop in the editor.
Why my vscode doesn't copy or cut when drag and drop the selected text. Should i need to install any extension for this to work.
I am using Windows 10, I also met the same issue.
Because there are two kinds of installers for Visual Studio Code: User Installer and System Installer, the User Installer have less privilege, but the User Installer is put in the first place in the official download page.
If you are an administrator account, any one of these two installers is OK.
But if you are non-administrator account and you installed the User Installer, the issue "drag and drop not working" will come.
So the solution is uninstall the User Installer of VS code, then re-install System Installer of VS code. It works perfect for me, may it be helpful for you too.
Current installation path by installer:
System Installer
%ProgramFiles%\Microsoft VS Code
User Installer
%LocalAppData%\Programs\Microsoft VS Code
add "editor.dragAndDrop":true in your settings.json
it's an known issue, please refer to :
https://github.com/microsoft/vscode/issues/93599
btw, you could use "Download" from right click menu
Release notes also say -
On macOS, press and hold the Option key while you drag and drop. Press the Ctrl key on Windows and press the Alt key on Linux.
See here

Install VSCode in a specific folder

I just downloaded the Visual Studio Code App from https://code.visualstudio.com/ and when I tried to install it, it simply just installed it by itself, without the option to change the installation path.
I have an external harddrive, which is where I want the IDE to be placed instead of the Local Harddrive. How can I change this?
On the VSCode download page select "System Installer" instead of "User Installer". The System installer will prompt you for the install location.
Full credit to Hans Passant for giving the following working solution as a comment.
The installer does very little beyond copying the files, it just creates some Explorer context menu shortcuts ("Open with Code"). Otherwise following Chromium conventions and copying itself to c:\Users\yourname\AppData\Local\Code\app-0.1.0 so it can update itself without you noticing. Boo. So high odds that simply moving that folder to the other drive works just fine, put it anywhere and create a shortcut to Code.exe. If you still want the context menu entry to work then use Regedit and search for "code\app-0.1.0".