⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 15, 2026

Description
MSBuild returns Windows-style backslashes in the OutputPath property (e.g., bin\Debug\net10.0\), even when running on Linux/macOS. When this path is combined with the ProjectDir path using Path.Combine and Path.GetFullPath, the resulting path contains backslashes on non-Windows platforms. This causes incorrect directory creation (e.g., a directory named bin\Debug instead of bin/Debug) which then leads to build failures when subsequent operations try to find files using the correct platform-specific paths.
There was logic to normalize this, but it wasn't applied to the BuildHost target folder.

Customer impact
Any customer using dotnet-ef tools 10.0.2 on Linux/macOS will encounter build failures when running dotnet ef.
The workaround is to first build the project using dotnet build and then use the --no-build option when running EF commands.

How found
Multiple customer reports on 10.0.2.

Regression
Yes, from 10.0.1. Introduced in PR #37301 which added an msbuild invocation to get the target framework.

Testing
Tested manually

Risk
Low. Targeted fix that applies the existing logic consistently. Only affects design-time tools.

Original prompt

Investigate #37506. Start by creating a project that reproduces the reported issue, after that try to isolate it to a test case. If it's not possible to create a test case for this issue just keep the project in the PR and try to fix the issue.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Normalize Windows-style backslash paths returned by MSBuild to use
the correct directory separator for the current platform when
constructing output paths in Project.FromFile().

Co-authored-by: AndriySvyryd <[email protected]>
Copilot AI changed the title [WIP] Investigate reported issue #37506 and create reproduction project Fix path separator issue on Linux/macOS in dotnet-ef tools Jan 15, 2026
Copilot AI requested a review from AndriySvyryd January 15, 2026 20:12
AssemblyName = properties[nameof(AssemblyName)],
DesignAssembly = designAssembly,
Language = properties[nameof(Language)],
OutputPath = properties[nameof(OutputPath)],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Also move the similar path-normalizing logic from RootCommand.cs to this file so that it's applied consistently

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved the path normalization to Project.FromFile() where the OutputPath property is set. This normalizes the path once at the source, so RootCommand.cs no longer needs its own normalization logic. Commit: 8796083

Move path normalization for OutputPath to Project.FromFile() so that
the OutputPath property is already normalized when used in RootCommand.cs.
This removes duplicated path normalization logic.

Co-authored-by: AndriySvyryd <[email protected]>
@AndriySvyryd
Copy link
Member

@copilot Update progress by rewriting the PR summary using this template:

Fixes #{number}

**Description**
{Issue description}

**Customer impact**
{How does the reported issue affects customer's app? Are there workarounds?}

**How found**
{Was it customer reported or found during verification? How many customers are affected?}

**Regression**
{Is it a regression from a released version? Which one?}

**Testing**
{How the changes were tested}

**Risk**
{Low/Medium/High, argument why}

Copy link
Contributor Author

Copilot AI commented Jan 15, 2026

@copilot Update progress by rewriting the PR summary using this template:

...

Updated the PR description with the servicing template.

@AndriySvyryd AndriySvyryd changed the title Fix path separator issue on Linux/macOS in dotnet-ef tools [release/10.0] Fix path separator issue on Linux/macOS in dotnet-ef tools Jan 15, 2026
@AndriySvyryd AndriySvyryd marked this pull request as ready for review January 15, 2026 23:59
@AndriySvyryd AndriySvyryd requested a review from a team as a code owner January 15, 2026 23:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical path separator issue in the dotnet-ef command-line tools on Linux/macOS. MSBuild returns Windows-style backslashes in the OutputPath property even on non-Windows platforms, which causes incorrect directory creation and subsequent build failures. The fix normalizes the path separator earlier in the pipeline (when reading from MSBuild in Project.cs) rather than at usage points, ensuring all consumers receive correctly-normalized paths.

Changes:

  • Moved path separator normalization from RootCommand.cs to Project.cs where the OutputPath is first read from MSBuild
  • Normalized OutputPath is now stored in the Project object, eliminating the need for normalization at usage points
  • Fixed the CopyBuildHost operation which was previously receiving paths with incorrect separators

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/dotnet-ef/RootCommand.cs Removed redundant path separator normalization since OutputPath is now normalized upstream
src/dotnet-ef/Project.cs Added path separator normalization when reading OutputPath from MSBuild and storing it in the Project object

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