Skip to content

NuGet again throwing exceptions "authors is required" "description is required", ignoring csproj/nuspec replacement tokens #9954

Closed
NuGet/NuGet.Client
#4461

Description

@bladewolf55

Maintainer edit

If you are still seeing this issue with the latest NuGet.exe version, please unblock the executable.

See: #9954 (comment)

Original report

For previous history on this problem, see issue #4234.

Using the exact same project and build:

NuGet Version 5.6.0.6591 does not display the Authors/Description error. However, version 5.7.0.6726 does.

I'm surprised this important issue doesn't seem to be regression tested. It's fixed, it comes back, it's fixed. . . .

5.6 output

nuget pack -verbosity detailed
NuGet Version: 5.6.0.6591
Attempting to build package from 'ClassLibrary1.csproj'.
MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug'.
Using 'ClassLibrary1.nuspec' for metadata.
Add file 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug\ClassLibrary1.dll' to package as 'lib\net472\ClassLibrary1.dll'

Id: ClassLibrary1
Version: 1.0.0
Authors: C
Description: D
Dependencies:

Added file '[Content_Types].xml'.
Added file '_rels/.rels'.
Added file 'ClassLibrary1.nuspec'.
Added file 'lib/net472/ClassLibrary1.dll'.
Added file 'package/services/metadata/core-properties/0a9c65c5d99145c6af36a7c3d0d48724.psmdcp'.

Successfully created package 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\ClassLibrary1.1.0.0.nupkg'.

5.7 output

nuget pack -verbosity detailed
NuGet Version: 5.7.0.6726
Attempting to build package from 'ClassLibrary1.csproj'.
MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
Packing files from 'C:\Users\charl\Google Drive\Development\NuGet Testing\NuGet Dependency Resolution\Framework Major-Numbered\ClassLibrary1\ClassLibrary1\bin\Debug'.
Could not load file or assembly 'file:///C:\Program Files (x86)\NuGet CLI\nuget.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
Using 'ClassLibrary1.nuspec' for metadata.
Authors is required.
Description is required.
System.Exception: Authors is required.
Description is required.
   at NuGet.Packaging.Manifest.Validate(Manifest manifest)
   at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
   at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
   at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
   at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
   at NuGet.Commands.PackCommandRunner.RunPackageBuild()
   at NuGet.CommandLine.PackCommand.ExecuteCommand()
   at NuGet.CommandLine.Command.ExecuteCommandAsync()
   at NuGet.CommandLine.Command.Execute()
   at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)

Activity

  1. changed the title [-]NuGet again throws exceptions "authors is required" "description is required", ignoring csproj/nuspec replacement tokens[/-] [+]NuGet again throwing exceptions "authors is required" "description is required", ignoring csproj/nuspec replacement tokens[/+] on Aug 28, 2020
  2. nkolev92 commented on Aug 28, 2020

    @nkolev92
    Member

    @bladewolf55 Can you please provide a repro?

    The change for the issue you are mentioning was in 5.7, not 5.6

  3. added
    WaitingForCustomerApplied when a NuGet triage person needs more info from the OP
    and removed
    RegressionDuringThisVersionA regression which broke since last RTM, and was fixed before the next RTM.
    on Aug 28, 2020
  4. kartheekp-ms commented on Aug 28, 2020

    @kartheekp-ms
    Contributor

    Thanks @nkolev92. I agree.
    @bladewolf55 - I am unable to reproduce the issue. I created a Classlibrary (.NET Framework) project in VS 2019 16.7.2 and executed nuget pack command which produced following output with couple of NU5115 warnings for missing values Description and Author in .csproj file.

    C:\{removed}>nuget-5.7.0.exe pack C:\{removed}\9954\ClassLibrary1 -verbosity detailed
    NuGet Version: 5.7.0.6726
    Attempting to build package from 'ClassLibrary1.csproj'.
    MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    Packing files from 'C:\{removed}\9954\ClassLibrary1\bin\Debug'.
    Add file 'C:\{removed}\9954\ClassLibrary1\bin\Debug\ClassLibrary1.dll' to package as 'lib\net472\ClassLibrary1.dll'
    WARNING: NU5115: Description was not specified. Using 'Description'.
    WARNING: NU5115: Author was not specified. Using '{my user name}'.
    
    Id: ClassLibrary1
    Version: 1.0.0
    Authors: {my user name}
    Description: Description
    Dependencies:
    
    Added file '[Content_Types].xml'.
    Added file '_rels/.rels'.
    Added file 'ClassLibrary1.nuspec'.
    Added file 'lib/net472/ClassLibrary1.dll'.
    Added file 'package/services/metadata/core-properties/b09a89a5c5644d5894b9a221d63dfc4e.psmdcp'.
    
    WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
    - Add a dependency group for .NETFramework4.7.2 to the nuspec
    Successfully created package 'C:\{removed}\ClassLibrary1.1.0.0.nupkg'.
    

    Can you please provide a repro?

  5. bladewolf55 commented on Aug 29, 2020

    @bladewolf55
    Author

    Of course. I should have provided that the first time.

    Environment

    • Visual Studio 2019 16.7.2
    • Windows 10 Pro (latest stable release)
    • NuGet CLI 5.7.0.6726

    Steps to Reproduce

    1. Create a .NET Framework Class Library (Framework 4.7.2)
    2. In the ClassLibrary1.csproj project folder, run nuget spec
    3. Reduce the resulting ClassLibrary1.nuspec file to the required properties
      <?xml version="1.0" encoding="utf-8"?>
      <package >
        <metadata>
          <id>$id$</id>
          <version>$version$</version>
          <authors>$author$</authors>
          <description>$description$</description>
        </metadata>
      </package>
    4. In Properties\AssemblyInfo.cs (or, in VS, ClassLibrary1 > Properties > Application > Assembly Information...) , add the values that are substituted for $description and $author:
      [assembly: AssemblyDescription("Desc")]
      [assembly: AssemblyConfiguration("")]
      [assembly: AssemblyCompany("Name")]
    5. Build the project or solution.
    6. In project folder, run nuget pack

    Expected: Successful build of new package

    Actual: Error that Author and Description are missing:

    Attempting to build package from 'ClassLibrary1.csproj'.
    MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'.
    Packing files from 'C:\Users\charl\Google Drive\Development\NuGet Testing\ClassLibrary1\ClassLibrary1\bin\Debug'.
    Using 'ClassLibrary1.nuspec' for metadata.
    Authors is required.
    Description is required.
    

    This error does not happen using nuget.exe 5.6x, as specified in the OP.

  6. zkat commented on Aug 31, 2020

    @zkat
    Contributor

    ping @rrelyea because hotseat. Can you confirm that this is an actual bug, or that a bugfix we did caused this to start (correctly) failing?

  7. rrelyea commented on Aug 31, 2020

    @rrelyea
    Contributor

    n.h.9954.zip

    Attached my repro attempt based on your instructions.
    extract zip file.
    have nuget.5.6.exe and nuget.5.7.exe in your path (or adapt repro.cmd)
    cd n.h.9954
    run repro.cmd (i used this: "repro.cmd 1> out.txt 2>&1")

    my output:

    C:\temp\n.h.9954\n.h.9954>msbuild /p:Configuration=release /v:minimal 
    Microsoft (R) Build Engine version 16.8.0-preview-20427-01+67225fa91 for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      n.h.9954 -> C:\temp\n.h.9954\n.h.9954\bin\Release\n.h.9954.dll
    
    C:\temp\n.h.9954\n.h.9954>nuget.5.6 pack -verbosity detailed -prop configuration=release 
    NuGet Version: 5.6.0.6591
    Attempting to build package from 'n.h.9954.csproj'.
    MSBuild auto-detection: using msbuild version '16.8.0.42701' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    Packing files from 'C:\temp\n.h.9954\n.h.9954\bin\Release'.
    Could not load file or assembly 'NuGet, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
    Using 'n.h.9954.nuspec' for metadata.
    Authors is required.
    Description is required.
    System.Exception: Authors is required.
    Description is required.
       at NuGet.Packaging.Manifest.Validate(Manifest manifest)
       at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
       at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
       at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
       at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(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)
    
    C:\temp\n.h.9954\n.h.9954>nuget.5.7 pack -verbosity detailed -prop configuration=release 
    NuGet Version: 5.7.0.6726
    Attempting to build package from 'n.h.9954.csproj'.
    MSBuild auto-detection: using msbuild version '16.8.0.42701' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\IntPreview\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    Packing files from 'C:\temp\n.h.9954\n.h.9954\bin\Release'.
    Using 'n.h.9954.nuspec' for metadata.
    Add file 'C:\temp\n.h.9954\n.h.9954\bin\Release\n.h.9954.dll' to package as 'lib\net472\n.h.9954.dll'
    
    Id: n.h.9954
    Version: 1.0.0
    Authors: Company Name
    Description: My Description
    Dependencies: 
    
    Added file '[Content_Types].xml'.
    Added file '_rels/.rels'.
    Added file 'lib/net472/n.h.9954.dll'.
    Added file 'n.h.9954.nuspec'.
    Added file 'package/services/metadata/core-properties/abe8b54b7f0e448392dd98a32db193c5.psmdcp'.
    
    WARNING: NU5128: Some target frameworks declared in the dependencies group of the nuspec and the lib/ref folder do not have exact matches in the other location. Consult the list of actions below:
    - Add a dependency group for .NETFramework4.7.2 to the nuspec
    Successfully created package 'C:\temp\n.h.9954\n.h.9954\n.h.9954.1.0.0.nupkg'.
    
    

    so it appears that it was broken in 5.6 and is now fixed in 5.7.
    What did we do differently?

  8. bladewolf55 commented on Sep 1, 2020

    @bladewolf55
    Author

    Here's my output using your zip file and running the command "repro.cmd 1> out.txt 2>&1. You'll see it's different than your results. The only difference I see is the MSBuild version. But be sure to read after that, because I'm getting different behaviors depending on how I build and pack.

    
    C:\Users\charl\Downloads\n.h.9954>msbuild /p:Configuration=release /v:minimal 
    Microsoft (R) Build Engine version 16.7.0+b89cb5fde for .NET Framework
    Copyright (C) Microsoft Corporation. All rights reserved.
    
      n.h.9954 -> C:\Users\charl\Downloads\n.h.9954\bin\Release\n.h.9954.dll
    
    C:\Users\charl\Downloads\n.h.9954>nuget.5.6 pack -verbosity detailed -prop configuration=release 
    NuGet Version: 5.6.0.6591
    Attempting to build package from 'n.h.9954.csproj'.
    MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    Packing files from 'C:\Users\charl\Downloads\n.h.9954\bin\Release'.
    Could not load file or assembly 'NuGet, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.
    Using 'n.h.9954.nuspec' for metadata.
    Authors is required.
    Description is required.
    System.Exception: Authors is required.
    Description is required.
       at NuGet.Packaging.Manifest.Validate(Manifest manifest)
       at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
       at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
       at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
       at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(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)
    
    C:\Users\charl\Downloads\n.h.9954>nuget.5.7 pack -verbosity detailed -prop configuration=release 
    NuGet Version: 5.7.0.6726
    Attempting to build package from 'n.h.9954.csproj'.
    MSBuild auto-detection: using msbuild version '16.7.0.37604' from 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.
    Packing files from 'C:\Users\charl\Downloads\n.h.9954\bin\Release'.
    Could not load file or assembly 'file:///C:\Users\charl\Downloads\n.h.9954\nuget.5.7.exe' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
    Using 'n.h.9954.nuspec' for metadata.
    Authors is required.
    Description is required.
    System.Exception: Authors is required.
    Description is required.
       at NuGet.Packaging.Manifest.Validate(Manifest manifest)
       at NuGet.Packaging.Manifest.ReadFrom(Stream stream, Func`2 propertyProvider, Boolean validateSchema)
       at NuGet.CommandLine.ProjectFactory.ProcessNuspec(PackageBuilder builder, String basePath)
       at NuGet.CommandLine.ProjectFactory.CreateBuilder(String basePath, NuGetVersion version, String suffix, Boolean buildIfNeeded, PackageBuilder builder)
       at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
       at NuGet.Commands.PackCommandRunner.RunPackageBuild()
       at NuGet.CommandLine.PackCommand.ExecuteCommand()
       at NuGet.CommandLine.Command.ExecuteCommandAsync()
       at NuGet.CommandLine.Command.Execute()
       at NuGet.CommandLine.Program.MainCore(String workingDirectory, String[] args)
    

    So, here are a few other ways to build and release. In each case, I delete the bin/obj folders and .nupkg file to start. I put the nuget executables in the project folder.

    Important: Ensure no other nuget.exe are on the Path

    1. Run msbuild /p:Configuration=release /v:minimal
    2. Run nuget.5.6 pack -verbosity detailed -prop configuration=release
      Get authors/description errors
    3. Delete bin/obj
    4. Run msbuild /p:Configuration=release /v:minimal
    5. Rename nuget.5.6.exe to nuget.exe
    6. Run nuget pack -verbosity detailed -prop configuration=release
      Pack succeeds

    Same as above, but with nuget.5.6.exe

    • Using nuget.5.6 pack shows errors
    • Using nuget pack shows errors

    1. Copy nuget.exe v5.7 into same folder as nuget.5.7.exe (in other words, nuget.exe and nuget.5.7.exe are on the path.

    2. Run msbuild as above

    3. Run nuget pack nuget.5.7.exe as above.
      Pack succeeds

    4. Run nuget pack nuget.5.7.exe as above.
      Pack succeeds


    However, using putting nuget.exe version 5.7 in the same folder doesn't succeed.


    Conclusions

    There are past reports of nuget behaving differently if it's renamed. I don't know if there are also reports of the renamed executed file picking up behavior from another nuget.exe in the path.

    My reproduction is, I think, a common use case: the latest nuget.exe in the path.

    As I see it right now, there are three bugs:

    1. The behavior of 5.6 changes depending on its name
    2. The behavior of 5.6 changes if the same version file named nuget.exe is in the path
    3. 5.7 fails in all cases as originally reported

    I'm puzzled why I could never get 5.7 to succeed as you did. But then, you didn't truly reproduce my conditions; you mutated them. And we all know from X-Men what happens when there's mutation.

  9. 35 remaining items

  10. robbyxp1 commented on Oct 15, 2021

    @robbyxp1

    This took about 3 hours of my time. Unblocking it (5.11) fixes the issue. Make sure its called nuget.exe, right click on its properties, and at the bottom unblock it.

  11. Sc0tTyXL commented on Oct 15, 2021

    @Sc0tTyXL

    This took about 3 hours of my time. Unblocking it (5.11) fixes the issue. Make sure its called nuget.exe, right click on its properties, and at the bottom unblock it.

    I can confirm that the issue exists on v5.11 and that Unblocking fixes the issue!

  12. dlech commented on Jan 18, 2022

    @dlech

    If manual unblocking is a requirement that can't be worked around, it would be super-awesome if nuget would spit out an error message that explained how to fix the problem instead of any unrelated error.

  13. self-assigned this
    on Feb 7, 2022
  14. added this to the Sprint 2022-02 milestone on Feb 7, 2022
  15. npakudin commented on Feb 8, 2022

    @npakudin

    Version 6.0.0.280 - for me problem exists

  16. erdembayar commented on Feb 8, 2022

    @erdembayar
    Contributor

    Version 6.0.0.280 - for me problem exists

    @npakudin
    Please upvote this issue at top, we prioritize based on community upvote & engagement.
    We're planning to add explicit message about need to unblock on Windows.

  17. robbyxp1 commented on Feb 9, 2022

    @robbyxp1

    The real solution of course would be to wrap the program in a proper installer, and then it would not be marked as blocked ;-)

  18. luislhg commented on Dec 28, 2022

    @luislhg

    I have nuget pack running this from an Azure Pipeline and thus my version is never set, always fixed in 1.0.0 because the $version$ is not read. How would I fix/unblock this on Azure/Cloud/Pipeline?

  19. mrkimpossible commented on Feb 23, 2023

    @mrkimpossible

    In case somebody stumbles on this issue, I just replaced the token $author$ to $authors$ in the nuspec file. I'm even using version 6.4.0.123 which is the latest at the time of this writing.

    The tokenized nuspec file gets generated after running nuget spec in a folder where a .csproj, .vbproj, or .fsproj exists.

  20. alexhiggins732 commented on May 7, 2023

    @alexhiggins732

    I had same error about Description being required. In my case even though the <Description> tag was set was set, another build property was setting <PackageDescription>.

    Changing the <PackageDescription> tag to <Description> resolved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions