NuGet / Home

Repo for NuGet Client issues
Other
1.5k stars 252 forks source link

PackagePath with trailing slash leads to zip file with bad entry #7004

Open natemcmaster opened 6 years ago

natemcmaster commented 6 years ago

When PackagePath has a trailing backslash, the nupkg produced contains an incorrect zip with // in the entry name.

Details about Problem

dotnet.exe --version: 2.1.300 OS: macOS Worked before?: not sure

Repro

  1. Clone this repo: https://github.com/aspnet/Mvc/tree/379345b530697ef11d86cc778c28e660696d8b77
  2. ./build.sh /p:SkipTests=true

Sample Project

The problem is here: https://github.com/aspnet/Mvc/blob/379345b530697ef11d86cc778c28e660696d8b77/src/Microsoft.AspNetCore.Mvc.Analyzers.Experimental/Microsoft.AspNetCore.Mvc.Analyzers.Experimental.csproj#L26

<None Include="$(OutputPath)$(AssemblyName).dll" Pack="true" PackagePath="analyzers\dotnet\cs\" />

When packing on macOS/Linux, this leads to a zip like this:

$ unzip -l ./artifacts/build/Microsoft.AspNetCore.Mvc.Analyzers.Experimental.0.2.0-preview1-t000.nupkg
Archive:  ./artifacts/build/Microsoft.AspNetCore.Mvc.Analyzers.Experimental.0.2.0-preview1-t000.nupkg
  Length      Date    Time    Name
---------  ---------- -----   ----
      537  06-07-2018 12:12   _rels/.rels
     1318  06-07-2018 12:12   Microsoft.AspNetCore.Mvc.Analyzers.Experimental.nuspec
    34816  06-07-2018 19:10   analyzers/dotnet/cs//Microsoft.AspNetCore.Mvc.Analyzers.Experimental.dll
      459  06-07-2018 12:12   [Content_Types].xml
      819  06-07-2018 12:12   package/services/metadata/core-properties/0016e2a84d834decb9a38be2bc6cb6cd.psmdcp
---------                     -------
    37949                     5 files

Notice the double slash in analyzers/dotnet/cs//Microsoft.AspNetCore.Mvc.Analyzers.Experimental.dll

rohit21agrawal commented 6 years ago

@natemcmaster this only happens when you use backslash in PackagePath on non-windows systems? or does it happen on windows too?

natemcmaster commented 6 years ago

This only happens on non-Windows.