I have same problem like someone have here:
Visual Studio get stuck on "Restoring packages for solution"
I try the following:
- Clear nuget cache from Tools menu. and temp, %temp% folders from RUN command.
- Clear visual studio cache from here. C:\Users\Dell\AppData\Roaming\Microsoft\VisualStudio\17.0_27e1b93f
- Clear .vs hidden folder of solution.
- Clean and Rebuild Solution. But stuck into Restoring Nuget packages...)
- I wait 15 minutes. But nothing happened.... (There's bug here?)
- I only use less than 7 nuget packages from nuget.org
Here's Visual Studio Log:
Microsoft Visual Studio Community 2022
Version 17.2.6
VisualStudio.17.Release/17.2.6 32630.192
Microsoft .NET Framework
Version 4.8.03761
Installed Version: Community
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ASP.NET and Web Tools 2019 17.2.393.26812
ASP.NET and Web Tools 2019
Azure App Service Tools v3.0.0 17.2.393.26812
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 17.2.393.26812
Azure Functions and Web Jobs Tools
BusinessObjectEditor 1.0
Information about my package
C# Tools 4.2.0-4.22281.5 8d3180e5f00d42f0f0295165f756f368f0cbfa44
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
CreateLayoutWizard 1.0
Create layout wizard.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
NuGet Package Manager 6.2.1
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
Razor (ASP.NET Core) 17.0.0.2218101 885a343b00bcab620a90c1550c37dafd730ce984
Provides languages services for ASP.NET Core Razor.
SQL Server Data Tools 17.0.62204.01010
Microsoft SQL Server Data Tools
TypeScript Tools 17.0.10418.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 4.2.0-4.22281.5 8d3180e5f00d42f0f0295165f756f368f0cbfa44
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 17.1.0-beta.22329.1 702b8e77f5fbfe21e6743324c1750503e02f182d
Microsoft Visual F# Tools
Visual Studio IntelliCode 2.2
AI-assisted development for Visual Studio.
More Information:
- I use old *.csproj project template (non-sdk)
- I use PackageReference not packages.config
- .NET 4.8
- Windows 7
- No proxy used. and official nuget.org/api/.... works in browser.
NOTE: this happened when I re-installed operating system.... Sometimes it took time. Sometimes it freeze and hangs on Restoring Nuget packages... message
Please how to solve that?
CodePudding user response:
According to your description I think the problem is that you used PackageReference and use nuget.exe to restore the packages.
We can see from this link that For projects migrated to PackageReference, use msbuild -t:restore to restore packages instead.
You can try msbuild -t:restore
instead of nuget restore ***.csproj
to restore packages if you are using PackageReference. For more details, please refer to the above link