Skip to content
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

Fix handling of relative paths when using graph builds with implicit restore #7361

Merged
merged 1 commit into from
Feb 15, 2022

Conversation

dfederm
Copy link
Contributor

@dfederm dfederm commented Feb 2, 2022

Fixes #5898

Context

Executing projects changes the cwd, which makes relative paths behave unexpectedly. So when an implicit restore happens (/restore), then the cwd is different than what it was originally. For non-graph builds, this isn't a problem as the BuildRequestData gets the full path of the project file before the implicit restore, so there effectively are no relative paths to deal with. However, this was not the case for GraphBuildRequestData, so doing a build with /retore, /graph, and a relative path to a project file was erroring incorrectly.

Changes Made

The ProjectGraphEntryPoint constructor will now get the full path of the project file, similar to what BuildRequestData does today.

I also followed all uses of ProjectGraphEntryPoint.ProjectFile and removed any normalization since it's now always done already.

Testing

I tested this change calling msbuild on a relative path with graph on/off and restore on/off. It now behaves as expected.

@rainersigwald rainersigwald added the merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now. label Feb 11, 2022
@rainersigwald rainersigwald added this to the VS 17.2 milestone Feb 11, 2022
@Forgind Forgind merged commit ea58158 into dotnet:main Feb 15, 2022
@dfederm dfederm deleted the fix-restore-plus-graph-builds branch February 18, 2022 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge-when-branch-open PRs that are approved, except that there is a problem that means we are not merging stuff right now.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

With static graph enabled, relative path isn't resolved correctly
4 participants