Skip to content

Fix hardcoded path separators in output paths#13222

Open
Serajfard wants to merge 2 commits intodotnet:mainfrom
Serajfard:fix-unix-path-separators
Open

Fix hardcoded path separators in output paths#13222
Serajfard wants to merge 2 commits intodotnet:mainfrom
Serajfard:fix-unix-path-separators

Conversation

@Serajfard
Copy link

@Serajfard Serajfard commented Feb 7, 2026

Microsoft.Common.CurrentVersion.targets hardcodes Windows path separators (\) when computing BaseOutputPath, OutputPath, BaseIntermediateOutputPath, and IntermediateOutputPath.

On Unix-based systems, \ is a valid filename character, not a path separator. This causes MSBuild to create literal directories such as bin\Debug, which are not ignored by standard .gitignore rules and can later break MSBuild path enumeration, globbing, and builds.

This issue is especially visible during design-time builds (e.g. dotnet ef migrations add) but can affect any build on non-Windows platforms.

  • Fixes locale-dependent sleep command formatting in unit tests on Unix.
  • Normalizes parallel logger output in binlog roundtrip tests by removing non-deterministic lines and target output items.
  • Updates OutputPath tests to use platform-appropriate trailing slashes.

@Serajfard
Copy link
Author

@dotnet-policy-service agree

@rainersigwald
Copy link
Member

MSBuild generally handles backslashes in path descriptions fine, by correcting them "just in time". I would like to dig into exactly what is going wrong, since these changes shouldn't be required and dramatically reduce readability.

Can you open an issue with repro steps that create one of the paths with literal backslashes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments