"Could not find a part of the path" using VS 2022 msbiuld

See original GitHub issue

When opening a solution with a long file path in VS Code using either VS 2022 msbuild or the standalone msbiuld the intellisense is broken.

The console app project will execute correctly when running dotnet run and VS 2022 correctly displays the solution.

I receive an error “Could not find a part of the path” in the omnisharp logs.

C# extension version v1.23.16

MS Build versions:

  1. Visual Studio Professional 2022 17.0.31825.309 17.0.0
  2. StandAlone 17.0.0

O/S: Windows 10 (21H1) Build 19043.1288

Log File: scratch2.txt

Reproducible solution: test-proj.zip

Logs of interest:

[info]: OmniSharp.MSBuild.ProjectManager
        Loading project: c:\Users\AlexBurgett\devel\temp\test-proj\src\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long.csproj
[fail]: OmniSharp.MSBuild.ProjectLoader
        Could not find a part of the path 'c:\Users\AlexBurgett\devel\temp\test-proj\src\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long\obj\Debug\net6.0\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long.GeneratedMSBuildEditorConfig.editorconfig'.
[warn]: OmniSharp.MSBuild.ProjectManager
        Failed to load project file 'c:\Users\AlexBurgett\devel\temp\test-proj\sr
c\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long.csproj'.
c:\Users\AlexBurgett\devel\temp\test-proj\src\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long.csproj
C:\Program Files\Microsoft Visual Studio\2022\Preview\MSBuild\Current\Bin\Roslyn\Microsoft.Managed.Core.targets(190,5): Error: Could not find a part of the path 'c:\Users\AlexBurgett\devel\temp\test-proj\src\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long\obj\Debug\net6.0\A.Really.Long.Long.Long.Long.Long.File.Path.That.Is.Really.Long.I.Mean.Really.Long.GeneratedMSBuildEditorConfig.editorconfig'.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:8
  • Comments:6

github_iconTop GitHub Comments

18reactions
schuettecarstencommented, Nov 23, 2021

I have the same issue, but I was able to fix it by enabling “long path support” in Windows 10: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

0reactions
ivanko337commented, Mar 7, 2023

I have the same issue, but I was able to fix it by enabling “long path support” in Windows 10: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation

I had an issue that .NET can’t build the .editorconfig with a long path file and this is helped

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error Could not find a part of the path when build ...
I'd start by increasing the MSBuild project build output verbosity (under tools -> options -> projects and solutions -> build and run), building ......
Read more >
Could not find a part of the path \roslyn\csc.exe
Anyone else getting the following issue on the lattest update of visual studio 2022 Could not find a part of the path ......
Read more >
Visual Studio 2019: Failure: Could not find a part of the path
When I use vs2019 16.8.4 to build an application,vs2019 will prompt: Could not write to "obj\Debug".Could not find a part of the ...
Read more >
GIT HUB example for ACS isnt working - Microsoft Q&A
Jul 13, 2022, 12:06 PM ... Error Could not find a part of the path ... Files\Microsoft Visual Studio\2022\Community\MSBuild\Current\Bin\Roslyn\Microsoft.
Read more >
MSB3101: Could not write state file 'filename'. - MSBuild
Typical issues include: the path was too long, permission was denied to the folder, a file was locked by another process, or the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found