11

I was doing a project, I runned 1 time and it was fine, I runned the second time and this error appeard "Could not write lines to file "obj\Debug\net5.0\SolutionName.GeneratedMSBuildEditorConfig.editorconfig exceeds the OS max path limit. The fully qualified file name must be less than 260 characteres. SolutionName C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets 150".

So I did a little research and the most common response was to re-install visual studio, so i did, but the error continued. So i create a new program and without doing any changes, in the new program, the same erros ocurred. The only thing i have in this new program is the main class with an "Hello world".

I assume its not a code problem and i can't find anything that answers why this error is appearing.

Rubs Bieira
  • 248
  • 2
  • 11

2 Answers2

11

I have same error, and that is related with 'file name must be less than 260 characters' and resolved by Enabling Windows Long Path via reference link: https://www.microfocus.com/documentation/filr/filr-4/filr-desktop/t47bx2ogpfz7.html

or do the following steps:

1- Click Window key and type gpedit.msc, then press the Enter key. This launches the Local Group Policy Editor.

2- Navigate to Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem.

3- Double click Enable NTFS long paths.

like this image

4- Select Enabled, then click OK.

5- at last restart visual studio

Hamed Lohi
  • 432
  • 4
  • 10
9

I have also experienced a similar issue. I resolved it by moving my project to the root of my C: Drive to try and shorten the name and the path of the project.

Dharman
  • 26,923
  • 21
  • 73
  • 125
Quince Ngomane
  • 172
  • 1
  • 15
  • i already fixed and that was it, the path to the project was to long, the only thing is that i dont know how could i run the program for like a week without any problems and in one day it wouldn work anymore. – Rubs Bieira Apr 15 '21 at 15:30