Search code examples
c#visual-studiopublish.net-5

Nuget error when trying to publish in .Net5


When I publish in .Net5 I get the following Errors

Severity Code Description Project File Line Suppression State Error Assets file 'C:\Users\cornelis.dejager\source\repos\Marel.MSAWebServiceAPI\Marel.MSAWebServiceAPI\obj\publish\win-x86\project.assets.json' not found. Run a NuGet package restore to generate this file. Marel.MSAWebServiceAPI 0

and

Severity Code Description Project File Line Suppression State Error Failed to retrieve information about 'Microsoft.WindowsDesktop.App.Runtime.win-x86' from remote source 'https://api.nuget.org/v3-flatcontainer/microsoft.windowsdesktop.app.runtime.win-x86/index.json'. An error occurred while sending the request. The request was aborted: Could not create SSL/TLS secure channel. Marel.MSAWebServiceAPI 0

What caused it:

Not sure to be honest. After I changed code it stopped working. The project has been fine for weeks now and suddenly it changed.

I have tried

  • Cleaned solution
  • Build/Re-Build Solution
  • Restore The Nuget Packages
  • Update Visual Studio
  • Rebuild All projects
  • Delete Bin & Object folders
  • Update all packages
  • Restarting Visual Studio + Computer
  • Created new publishing profile
  • install dotnet-WindowsDesktop
  • Reinstall .Net5 Runtimes
  • Run the command:

Additional Info

  • It builds and run fine. Only when I publish it seems to give me an error.

I really do not why publishing isn't working. I've looked at several places but have not found a solution to it yet.


Solution

  • It may happen from the wrong package source,

    In Visual Studio go to

    Options=> Nuget Package Manager=> Package Sources

    if you are using a custom source make sure you have entered the address correctly. NuGet default source address is https://api.nuget.org/v3/index.json