Description
Issue Description
I've been working a bit on a bug in the dotnet/sdk#559, and stumbled upon something that might be considered a bug in either Microsoft.Build.Utilities.TaskItem, or Microsoft.Build.Shared.FileUtilities.FixFilePath. One might also argue that it's not a bug, and that it's the usage of it in Microsoft.NET.Build.Containers.Tasks.CreateNewImage that is wrong.
Anyway, the problem is, when publishing dotnet projects to containers, some properties are set on the CreateNewImage MSBuild task, that are needed runtime in the built container. So, the paths need to be compatible with the container target platform, not the platform it's built on. The properties in question are (at least) Entrypoint, EntrypointArgs, AppCommand, AppCommandArgs.
However, as the properties are of type ITaskItem
, implemented by TaskItem
, the paths are normalised when initialised. And, the normalisation uses the Path.DirectorySeparatorChar of the build platform, not the target.
Would you consider this a bug/shortcoming in the TaskItem
, or are we/they using it in the wrong way in the MSBuild task?
Steps to Reproduce
Use a TaskItem
in an MSBuild task, where you need the directory separator char of a different platform than the one you are building on (e.g. use C:\app\foo.exe when building on *nix)
Expected Behavior
The item should stay as C:\app\foo.exe
Actual Behavior
The path is changed to C:/app/foo.exe
Analysis
msbuild/src/Utilities/TaskItem.cs
Line 80 in 8632094
There is no way to tell either: 1) That you don't want normalisation of directory separator characters, or 2) which style of normalisation you want
Versions & Configurations
dotnet msbuild --version
17.11.0.25706