msbuild
msbuild copied to clipboard
[Bug]: Project file does not exist with LongPaths
Issue Description
Having a project under a long path does not work.
dotnet build D:\foo\github\projects\super_long_project_name_that_keeps_going_and_going_and_never_seems_to_end\src\data\files\documents\category\sub_category\type\long_directory_name_with_lots_of_details_and_information\more_files\even_more_nested_folders_with_descriptive_names\additional_folders_for_length\final_directory_with_ver\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj -v:diag
MSBUILD : error MSB1009: Project file does not exist.
Switch: D:\foo\github\projects\super_long_project_name_that_keeps_going_and_going_and_never_seems_to_end\src\data\files\documents\category\sub_category\type\long_directory_name_with_lots_of_details_and_information\more_files\even_more_nested_folders_with_descriptive_names\additional_folders_for_length\final_directory_with_ver\ConsoleApp1\ConsoleApp1\ConsoleApp1.csproj
Version:
Dotnet 8.0.300
MSBuild version 17.10.4+10fbfbf2e for .NET
When having a Traversal project with ProjectReferences result in the same where the ProjectReference can't be found.
Enabling Long Paths on the OS fixes it. Is that the recommended way? https://github.com/dotnet/msbuild/issues/1267
Steps to Reproduce
adding -bl dont produce the binlog, not sure if thats the same issue.
Expected Behavior
That we can compile projects, no matter the length of the path.
Actual Behavior
Weird failures not specifying that its MAX_PATH related.
Analysis
No response
Versions & Configurations
No response
fyi @rainersigwald Let me know what else information you need
Team triage:
Is that the recommended way?
Yes, we recommend enabling Long Paths on the OS to fix this. As part of this issue, we should consider updating the error message to include the fixing instructions, if we are able to detect this from code.
As for absence of the binlog, it seems that it is not created because the evaluation and execution of any targets does not happen in this case. I will create a new issue with a feature request concerning creating a tiny binary log in such cases, it might be still helpful.
@JaynieBai can you please try to reproduce this issue on both dotnet build and msbuild.exe?
Team triage:
Is that the recommended way?
Yes, we recommend enabling Long Paths on the OS to fix this. As part of this issue, we should consider updating the error message to include the fixing instructions, if we are able to detect this from code.
As for absence of the binlog, it seems that it is not created because the evaluation and execution of any targets does not happen in this case. I will create a new issue with a feature request concerning creating a tiny binary log in such cases, it might be still helpful.
@JaynieBai can you please try to reproduce this issue on both dotnet build and msbuild.exe?
I can repro this on dotnet build and msbuild
In windows with long path disabled, the MAX_PATH is 260 https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry
Test this with latest dotnet build when longpath is disabled. The error is "error CS5001: Program does not contain a static 'Main' method suitable for an entry point. " .This is since the Program.cs is not evaluated correctly.