NuGet SSL/TLS error after upgrading from VS2015 to VS2019

peter.morlion's Avatar


07 Dec, 2020 06:49 PM

I'm modernizing a legacy project that was still being built using the "Visual Studio 2015" image. I changed that to "Visual Studio 2019" and now my build fails. It seems it can't restore any NuGet package:

" Unable to load the service index for source
  An error occurred while sending the request.
  The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
  The remote certificate is invalid according to the validation procedure."

If I rebuild a previous commit (which uses VS2015), I see it uses the NuGet v2 feed and these do succeed.

When I build locally on my machine, my VS2019 uses the v3 feed too, and without errors.

I've Googled around, but can't seem to find any others who have this issue recently.

  1. Support Staff 1 Posted by Feodor Fitsner on 07 Dec, 2020 06:55 PM

    Feodor Fitsner's Avatar

    Hi Peter,

    Last year there was a fix for failing NuGet. You might still have it in your build configuration, something like:

    [System.IO.File]::AppendAllText("C:\Windows\System32\drivers\etc\hosts", "`n93.184.221.200`")

    This fix is not needed anymore.

  2. 2 Posted by peter.morlion on 08 Dec, 2020 10:01 AM

    peter.morlion's Avatar

    That seems to be it, thanks.

  3. peter.morlion closed this discussion on 28 May, 2021 11:00 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac