NuGet / Home

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

NuGet PackTask should report all files that are not found instead of stopping at the first one #6418

Open dsplaisted opened 6 years ago

dsplaisted commented 6 years ago

EXPECTED: Build errors listing all of the files listed in the .nuspec that can't be found ACTUAL: Error for only the first missing file:

C:\Program Files\dotnet\sdk\2.1.4\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(204,5): error : File not found: 'C:\git\msbuild\artifacts\Debug\bin\MSBuild\net46/System.Security.Cryptography.Algorithms.dll'.

This can become quite cumbersome when you have a .nuspec with a large number of files that is packed at the end of a long build. You'll get an error for just the first missing file, and when you fix it you'll have to do the whole build again, and repeat this for each missing file in the .nuspec.

nkolev92 commented 6 years ago

//cc @rohit21agrawal

rohit21agrawal commented 6 years ago

won't be on the top of my list to fix, but will gladly accept a PR. the fix will revolve around wrapping the line AddFiles in PackageBuilder in a try-catch block and aggregating the failures, and throwing an exception in the end. (https://github.com/NuGet/NuGet.Client/blob/dev/src/NuGet.Core/NuGet.Packaging/PackageCreation/Authoring/PackageBuilder.cs#L546)