Skip to content

MSBuild::NormalizePath does not correctly canocalize paths containing back-slashes on xplat #5114

Open
@pranavkm

Description

@pranavkm

Steps to reproduce

Project file

<Project>
    <Target Name="TestNormalize">
        <PropertyGroup>
            <Dir1>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)..\test'))</Dir1>
            <Dir2>$([MSBuild]::NormalizePath('$(MSBuildThisFileDirectory)../test'))</Dir2>
        </PropertyGroup>
        
        <Message Text="$(Dir1) $(Dir2)" Importance="High" />
    </Target>
</Project>

On Windows, the result is:

D:\test D:\test

On Ubuntu, this is what I get:

/mnt/d/utemp/../test /mnt/d/test

This is not a problem since the File I/O APIs would resolve either paths. However, in this particular I was trying to remove an item from an ItemGroup using it's canonicalized path.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions