I was upgrading the solution from .Net core 3.1 to .NET 6.0 and got the below error while building the project.
“Package StyleCop.Analyzers, version 1.0.2 was not found. It might have been deleted since NuGet restore. Otherwise, NuGet restore might have only partially completed, which might have been due to maximum path length restrictions.”
Then I tried to clean and build the solution again, but the error didn’t disappear. So later, I found the solution to this.
- Launch Group Policy Editor. Run “gpedit.msc” from the Rum command (Windows-R and then type “gpedit.msc” and click on). Alternatively in Start search bar search “Edit group policy” and open Group Policy Editor.
- Go to Local Group Policy Editor as illustrated below, Select enable “Local Computer Policy” à Administrative templatesàAll Settingsà Enable Win32 long paths.
Click Enable, Apply, and then click Ok as depicted below.
Note that, this is supported in Windows 10 and Windows Server 2016.
Restart the visual studio and try building the solution.
Run the below command
If you are still getting the error then try running the below cmd.
You can follow the below links for details.