It took me some time to figure out the whole picture and I'd like to share here.
Visual Studio has two approaches to use package restore: Automatic Package Restore and MSBuild-Integrated package restore. The 'MSBuild-Integrated Package Restore' restores packages DURING the building process that might cause issues in some scenarios. The 'Automatic Package Restore' is the recommended approach by the NuGet team.
There are several steps to to make 'Automatic Package Restore' work:
In Visual Studio, Tools -> Extensions and Updates, Upgrade NuGet if there is a newer version (Version 2.7 or later)
If you use TFS, in your solution's .nuget folder, remove the NuGet.exe and NuGet.targes files. Then edit NuGet.Config to not check in NuGet packages:
<configuration>
<solution>
<add key="disableSourceControlIntegration" value="true" />
</solution>
</configuration>
If you checked in the solution's packages folder to TFS before, delete the folder and check in the deletion of package folder deletion.
If you don't use TFS, delete the .nuget folder.
In each project file (.csproj or .vbproj) in your solution, remove the line that references NuGet.targets file. The reference looks like this:
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
Remove this line in every project file in your solution.
In Visual Studio menu, either through
Tools -> Options -> Package Manager -> General or Tools -> NuGet Package Manager -> Package Manager Settings
please enable the following two options 1) 'Allow NuGet to download missing packages' 2) 'Automatically check for missing packages during build in Visual Studio'
Test your package restore configuration by the following steps