Fixup project reference paths during file-based app conversion#50860
Fixup project reference paths during file-based app conversion#50860baronfel merged 3 commits intodotnet:release/10.0.1xxfrom
Conversation
|
This PR is targeting |
There was a problem hiding this comment.
Pull Request Overview
This PR fixes project reference path handling during file-based application conversion by ensuring relative paths are properly adjusted when the output directory differs from the source directory.
- Adds logic to update relative project reference paths to be relative to the output directory instead of source directory
- Preserves absolute paths as-is while only modifying relative paths during conversion
- Adds comprehensive test coverage for various relative and absolute path scenarios
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs | Adds test cases covering relative and absolute project reference path conversion scenarios |
| src/Cli/dotnet/Commands/Run/VirtualProjectBuildingCommand.cs | Adds WithName method to Project class and preserves absolute paths during directive processing |
| src/Cli/dotnet/Commands/Project/Convert/ProjectConvertCommand.cs | Implements UpdateDirectives method to adjust relative project reference paths for the target directory |
test/dotnet.Tests/CommandTests/Project/Convert/DotnetProjectConvertTests.cs
Show resolved
Hide resolved
| [Theory] // https://github.com/dotnet/sdk/issues/50832 | ||
| [InlineData("File", "Lib", "../Lib", "Project", "../Lib/lib.csproj")] | ||
| [InlineData(".", "Lib", "./Lib", "Project", "../Lib/lib.csproj")] | ||
| [InlineData("File", "Lib", "../Lib", "File/Project", "../../Lib/lib.csproj")] |
There was a problem hiding this comment.
Consider also testing a case where the original path has redundant ..s in it, such as Lib/../Lib, I would expect such paths to get normalized (be treated as equivalent to just Lib).
There was a problem hiding this comment.
Consider also testing both windows and unix path separators.
|
@MiYanni for a review, thanks |
Fixes #50832.