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

Paths don't round trip on Unix #11418

Closed
lewing opened this issue Apr 24, 2020 · 5 comments
Closed

Paths don't round trip on Unix #11418

lewing opened this issue Apr 24, 2020 · 5 comments

Comments

@lewing
Copy link
Member

lewing commented Apr 24, 2020

While testing out path problems in other parts of the system I ran into this case on unix

pwd
/Users/lewing/Source/Test#our codedir/File%20Test
xamlewing-good:File%20Test lewing$ dotnet build
Microsoft (R) Build Engine version 16.5.0+d4cbfca49 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.
  Restore completed in 50.91 ms for /Users/lewing/Source/Test#our codedir/File%20Test/File%20Test.csproj.
/usr/local/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1004: Assets file '/Users/lewing/Source/Test#our codedir/File Test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/lewing/Source/Test#our codedir/File%20Test/File%20Test.csproj]
Build FAILED.
/usr/local/share/dotnet/sdk/3.1.201/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(234,5): error NETSDK1004: Assets file '/Users/lewing/Source/Test#our codedir/File Test/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/lewing/Source/Test#our codedir/File%20Test/File%20Test.csproj]
    0 Warning(s)
    1 Error(s)
Time Elapsed 00:00:00.88

The %20 in the actual path /Users/lewing/Source/Test#our codedir/File%20Test is being unescaped incorrectly leading to a build failure.

@lewing
Copy link
Member Author

lewing commented Jul 21, 2020

mkdir "Happy%20day"
cd "Happy%20day"
dotnet build
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET. See: https://aka.ms/dotnet-core-preview
/Users/lewing/Source/runtime/.dotnet/sdk/5.0.100-preview.8.20362.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1004: Assets file '/Users/lewing/Source/Happy day/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/lewing/Source/Happy%20day/Happy%20day.csproj]

Build FAILED.

/Users/lewing/Source/runtime/.dotnet/sdk/5.0.100-preview.8.20362.3/Sdks/Microsoft.NET.Sdk/targets/Microsoft.PackageDependencyResolution.targets(241,5): error NETSDK1004: Assets file '/Users/lewing/Source/Happy day/obj/project.assets.json' not found. Run a NuGet package restore to generate this file. [/Users/lewing/Source/Happy%20day/Happy%20day.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.54

@lewing
Copy link
Member Author

lewing commented Jul 21, 2020

cc @rainersigwald

@lewing
Copy link
Member Author

lewing commented Jul 21, 2020

lewing@MacBook-Pro ~ % mkdir "Happy?day=no"
lewing@MacBook-Pro ~ % cd Happy\?day=no 
lewing@MacBook-Pro Happy?day=no % dotnet new console
The template "Console Application" was created successfully.

Processing post-creation actions...
Running 'dotnet restore' on /Users/lewing/Happy?day=no/Happy?day=no.csproj...
  Determining projects to restore...
  Restored /Users/lewing/Happy?day=no/Happy?day=no.csproj (in 56 ms).
Restore succeeded.

lewing@MacBook-Pro Happy?day=no % dotnet build
Microsoft (R) Build Engine version 16.7.0-preview-20360-03+188921e2f for .NET
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
/Users/lewing/Source/runtime/.dotnet/sdk/5.0.100-preview.8.20362.3/Current/Microsoft.Common.props(62,3): error MSB4019: The imported project "/Users/lewing/Happy?day=no/obj/Happy?day=no.csproj.*.props" was not found. Confirm that the expression in the Import declaration "/Users/lewing/Happy%3fday=no/obj/Happy%3fday=no.csproj.*.props" is correct, and that the file exists on disk. [/Users/lewing/Happy?day=no/Happy?day=no.csproj]

Build FAILED.

/Users/lewing/Source/runtime/.dotnet/sdk/5.0.100-preview.8.20362.3/Current/Microsoft.Common.props(62,3): error MSB4019: The imported project "/Users/lewing/Happy?day=no/obj/Happy?day=no.csproj.*.props" was not found. Confirm that the expression in the Import declaration "/Users/lewing/Happy%3fday=no/obj/Happy%3fday=no.csproj.*.props" is correct, and that the file exists on disk. [/Users/lewing/Happy?day=no/Happy?day=no.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.47

@lewing lewing changed the title Paths url decoded incorrectly Paths don't round trip on Unix Jul 21, 2020
@lewing
Copy link
Member Author

lewing commented Jul 21, 2020

Round tripping is related to dotnet/runtime#1061

@rainersigwald
Copy link
Member

Tracked by dotnet/msbuild#2178. Unfortunately, I don't think there's an easy way to resolve this because the MSBuild engine's internal escaping code is a typeless mess.

@lewing lewing closed this as completed Jul 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants