NuGet/Home

System.FormatException thrown when restoring package with invalid copyToOutput attribute on content files

Open

#10.303 geöffnet am 19. Nov. 2020

Auf GitHub ansehen
 (0 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)HTML (292 Forks)batch import
Area:ErrorHandlingFunctionality:RestorePriority:3Type:Bughelp wanted

Repository-Metriken

Stars
 (1.459 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 464T 23h) (1 gemergte PR in 30 T)

Beschreibung

Details about Problem

NuGet product used (NuGet.exe | VS UI | Package Manager Console | dotnet.exe): msbuild.exe as part of Visual Studio 16.8.1

NuGet.Build.Tasks version: 5.8.0.6930

msbuild -version: Microsoft (R) Build Engine version 16.8.1+bd2ea1e3c for .NET Framework Copyright (C) Microsoft Corporation. All rights reserved.

16.8.1.52902 VS version (if appropriate) 16.8.1

OS version (i.e. win10 v1607 (14393.321)): win10 v1909 (18363.1082)

Worked before? If so, with which NuGet version: Not sure

Detailed repro steps so we can see the same problem

  1. Create a nuget package with a non-bool value for a copyToOutput attribute ("PreserveNewest" and/or "Never") were used in my case.

  2. Add a reference to that NuGet package using a item in a .NET SDK project

  3. Run msbuild /t:restore on the project.

  4. The restore fails with a System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list. thrown from NuspecReader.AttributeAsNullableBool instead of a more helpful PackagingException with information about the actual package issue.

Verbose Logs

MsBuild logs are uploaded in logfiles.zip

Sample Project

Download and extract reproduce.zip and call msbuild reproduce.proj

Contributor Guide