-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
With static graph enabled, relative path isn't resolved correctly #5898
Comments
I repro with two interesting tidbits:
|
Same debug copy of MSBuild repros when put in a .NET 5 install. Proximate cause is here:
because the CWD is changed to the entry-point's folder. Not sure why yet. |
Something in
|
That pretty much sums up what I tested things on, and what our CI tests against :) |
I wonder if this is going to start failing when we update to target .NET 5. |
I was wondering why the static graph tests in the sdk are passing. But when I looked into it I remembered that they got disabled and we didn't follow up into reenabling them |
It looks like just doing a graph build changes the working directory--I see it when I disable restore but break in and check after the main call to I'm going to stop looking at this for the moment but we should definitely chase this down. |
BTW, I think that invalidates my other findings: |
@dfederm Would you be looking into static graph issues going forward? |
@marcpopMSFT Sure, will take a look. |
Looks like the cwd gets changed with non-graph builds too, but paths are resolved to be absolute beforehand so it's not a problem. Likely we just need to do the same with the graph build request |
…restore (#7361) 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.
Using the 5.0.100 SDK. Looks like msbuild concatenates the relative path passed in with the path that resolves to the project file.
cc @rainersigwald @cdmihai
The text was updated successfully, but these errors were encountered: