Home > database >  "The underlying connection was closed: An unexpected error occurred on a send." when build
"The underlying connection was closed: An unexpected error occurred on a send." when build

Time:10-29

My laptop died and I switched to the new one. Get code from source control, but have to reinstall all NuGet packages. Now when I try to build the project I get "The underlying connection was closed: An unexpected error occurred on a send." I use VS 2015.

Any idea how to fix it?

CodePudding user response:

Sounds like a ServicePointManager.SecurityProtocol issue.

My assumption is that you are targeting a differnt framework then the one you had before. In .NET 4.6 and above. You don’t need to do any additional work to support TLS 1.2, it’s supported by default. try to open it in visual studio and it will detect it for you.

CodePudding user response:

OK I got it just in 10 minutes after posting the question... Folder .nuget was missed from source control and VS tried to get NuGet.exe file (I have the settings "Download NuGet.exe if it does not already exist" enabled) but looks like it cannot for some reason. I copied NuGet.exe from another project and it resolve it.

  • Related