Search code examples
c#packagevisual-studio-mac

"Could not restore packages" in Visual Studio code when opening a project


After each update of MacOS or Visual Studio any project I open throws this error and can't restore packages. It happens in Visual Studio for Mac, the latest version.

Screenshot of the package console

1

Once I had a similar issue when a vpm connection was active, after disabling it Visual Studio had no issues with packages. But this time I don't have any VPN enabled.


Solution

  • For those who is interested, I found a solution to this issue.

    1. Execute this command in terminal for the project dotnet nuget locals --clear all
    2. While the project(solution) is opened in the Visual Studio, double-click on the top file (Solution) > Build > General > check the Build with MSBuild on Mono option.