Closed megakid closed 4 years ago
We get the same IndexOutOfRangeException with NuGet.exe 5.4.0.6315. Running NuGet.exe pack
with -Verbosity detailed
gives us the call stack, pointing to NuGet.Packaging.Rules.UpholdBuildConventionRule.GetFolderName
.
As I (and @megakid) both had nuspec files trying to place a file in the package root folder, I guess that UpholdBuildConventionRule.GetFolderName does not handle files without a folder component.
Successfully created package 'C:\src\github\factor10\x10-build\build\x10.BuildScript.1.0.0.nupkg'.
Index was outside the bounds of the array.
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at NuGet.Packaging.Rules.UpholdBuildConventionRule.GetFolderName(String filePath)
at System.Linq.Lookup`2.Create[TSource](IEnumerable`1 source, Func`2 keySelector, Func`2 elementSelector, IEqualityComparer`1 comparer)
at System.Linq.GroupedEnumerable`3.GetEnumerator()
at NuGet.Packaging.Rules.UpholdBuildConventionRule.IdentifyViolators(IEnumerable`1 files, String packageId)
at NuGet.Packaging.Rules.UpholdBuildConventionRule.Validate(PackageArchiveReader builder)
at NuGet.Commands.PackCommandRunner.AnalyzePackage(PackageArchiveReader package)
at NuGet.Commands.PackCommandRunner.BuildFromNuspec(String path)
at NuGet.Commands.PackCommandRunner.BuildPackage()
at NuGet.CommandLine.PackCommand.ExecuteCommand()
at NuGet.CommandLine.Command.ExecuteCommandAsync()
at NuGet.CommandLine.Command.Execute()
at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
In our case the offending line is
<file src="FAKE\*.fsx" target="" />
If I remove this (or make it not actually match a file) then packaging succeeds (although we also get warnings, in our case NU5101 which recommends not placing dlls directly under the lib folder)
@zivkan Related to https://github.com/NuGet/Home/issues/9388 & https://github.com/NuGet/Home/issues/9055
Hitting the same issue. Pinning nuget 5.2 solves the issue for the time being.
Can anyone explain the following - I'm pretty sure something isn't right but can't figure out what.
We had a build failure on our CI server today caused by the release of
NuGet.CommandLine 5.3.0
- we have now pinned our build to5.2.0
to work around the issue.Here's our
.nuspec
file:Comparing the two versions, side-by-side: