Project x was not imported due to file not existing (path length issue)

771 views Asked by At

I am currently facing the error (see screenshot) where I can not add dependencies anymore on my Visual Studio solution. Would this have to do with path issues, or is something else going on.

I already tried nuget restore, cleaning the solution etc...

The reason the filenames are so long is because of clarity where they belong to, but if this is a limitation (which I expect, but can't find it) then how do I best go to work?

Error in VS2019

1

There are 1 answers

1
Volkan Barbaros Gurcan On BEST ANSWER

OS also has a MAX_PATH limitation. This limitation is 260 characters. Even if your file path is below this character limit, you may experience issues due to reserved space. post

I recommend creating a simple and short hierarchy and naming. You will have a lot of trouble naming this way.

If you want to continue naming this, make the following settings in your operating system and reopen and test your project:

First,

  • open the registry with regedit
  • Double click LongPathsEnabled in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem. If this item is missing, create a new one. Set Value Data to 1 and save

Second, (if In Windows 10 Pro or Enterprise)

  • Run gpedit.msc in the Start menu
  • Find "Enable Win32 long paths" under "Computer Configuration > Administrative Templates > System > Filesystem" and double click to open it
  • Mark as Enabled and save

Restart the computer.

Once your computer restarts and you open your project, the problem should be resolved.

If there is still a yellow warning next to NuGet packages, confirm it by typing dotnet restore in Nuget Packet Manager. (Make sure you choose the default project correctly). Restart Visual Studio if needed.