-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Fixup project reference paths during file-based app conversion #50860
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup project reference paths during file-based app conversion #50860
Conversation
This PR is targeting |
There was a problem hiding this 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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider also testing both windows and unix path separators.
@MiYanni for a review, thanks |
Fixes #50832.