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

ProjectInSolution.AbsolutePath should return a normalized full path #5949

Closed
jeffkl opened this issue Dec 9, 2020 · 1 comment · Fixed by #5950
Closed

ProjectInSolution.AbsolutePath should return a normalized full path #5949

jeffkl opened this issue Dec 9, 2020 · 1 comment · Fixed by #5950
Labels
bug needs-triage Have yet to determine what bucket this goes in.

Comments

@jeffkl
Copy link
Contributor

jeffkl commented Dec 9, 2020

Issue Description

ProjectInSolution.AbsolutePath currently returns the result of Path.Combine() which leaves in relative path segments like ..\. When parsing a solution and getting the paths to projects, this places the burden on the caller to normalize the path.

public string AbsolutePath => Path.Combine(ParentSolution.SolutionFileDirectory, RelativePath);

Steps to Reproduce

Create a solution with relative paths containing ..\
Parse the solution with the SolutionFile API
Call the AbsolutePath property on one of the ProjectInSolution objects.

Expected Behavior

AbsolutePath property returns a normalized full path.

Actual Behavior

AbsolutePath property returns a path containing ..\ segments.

Analysis

Versions & Configurations

All versions of MSBuild

This manifested into this bug: NuGet/Home#10307

And its worked around in MSBuild's own codebase:

new ProjectGraphEntryPoint(
FileUtilities.NormalizePath(project.AbsolutePath),
solutionGlobalProperties
.SetItem("Configuration", projectConfiguration.ConfigurationName)
.SetItem("Platform", projectConfiguration.PlatformName)
));

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs-triage Have yet to determine what bucket this goes in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants