Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: error NU5039: The readme file 'readme.md' does not exist in the package. #11292

Closed
uladz-zubrycki opened this issue Oct 4, 2021 · 9 comments
Assignees
Labels
Priority:1 High priority issues that must be resolved in the current sprint. Triage:NeedsTriageDiscussion Type:Bug

Comments

@uladz-zubrycki
Copy link

uladz-zubrycki commented Oct 4, 2021

NuGet Product Used

dotnet.exe

Product Version

MSBuild 16.11.0+0538acc04; .NET SDK 5.0.401 4bef5f3dbf; OS Windows 10.0.19042 win10-x64;

Worked before?

No response

Impact

It's more difficult to complete my work

Repro Steps & Context

Steps:

  1. Download attached solution NugetReadmeRepro.zip;
  2. Run publish.cmd.

Expected result:
dotnet pack finishes successfully outputting both nupkg and snupkg in the output directory. Readme is embedded into the nupkg and rendered at nuget.org after the publish.

Actual result:
dotnet pack fails with error NU5039: The readme file 'readme.md' does not exist in the package. readme.md is embedded into the nupkg root directory though.

Workaround:
Remove SymbolPackageFormat or don't try to include a readme file. Therefore it looks to me the same root cause as #10791
Even the error stacktrace looks pretty much the same – ValidateReadmeFile during symbols package build.

 Attempting to build symbols package for 'NugetReadmeRepro.csproj'. (TaskId:112)
19:49:29.819   1:7>C:\Program Files\dotnet\sdk\5.0.401\Sdks\NuGet.Build.Tasks.Pack\build\NuGet.Build.Tasks.Pack.targets(221,5): error NU5039: The readme file 'readme.md' does not exist in the package. [D:\dev\NugetReadmeRepro\NugetReadmeRepro.csproj]
                     NuGet.Packaging.Core.PackagingException: The readme file 'readme.md' does not exist in the package.
                        at NuGet.Packaging.PackageBuilder.ValidateReadmeFile(IEnumerable`1 files, String readmePath)
                        at NuGet.Packaging.PackageBuilder.Save(Stream stream)
                        at NuGet.Commands.PackCommandRunner.BuildPackage(PackageBuilder builder, String outputPath, Boolean symbolsPackage)
                        at NuGet.Commands.PackCommandRunner.BuildFromProjectFile(String path)
                        at NuGet.Commands.PackCommandRunner.BuildPackage(String path)
                        at NuGet.Commands.PackCommandRunner.RunPackageBuild()
                        at NuGet.Build.Tasks.Pack.PackTaskLogic.BuildPackage(PackCommandRunner runner)
                        at NuGet.Build.Tasks.Pack.PackTask.Execute() (TaskId:112)
                   Done executing task "PackTask" -- FAILED. (TaskId:112)

Sample solution contents:

<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFramework>netstandard2.0</TargetFramework>
        <LangVersion>latest</LangVersion>
        <Configuration>Release</Configuration>
        <PackageId>NugetReadmeRepro</PackageId>
        <Description>NugetReadmeRepro</Description>
        <IncludeSymbols>true</IncludeSymbols>
        <SymbolPackageFormat>snupkg</SymbolPackageFormat>
        <PackageReadmeFile>readme.md</PackageReadmeFile>
	</PropertyGroup>
    <ItemGroup>
        <None Include="readme.md" Pack="true" PackagePath=""/>
    </ItemGroup>
</Project>
@echo off
SET "outpath=%~dp0out"

if exist %outpath%\ (
    rmdir /s /q %outpath%
)

dotnet pack "NugetReadmeRepro.csproj" -p:PackageVersion=0.0.1 -p:OutputPath=%outpath% --verbosity diag
if %errorlevel% neq 0 exit /b %errorlevel%

Logs:
diag.log

Verbose Logs

Pls, don't ask for it this way. I just ended up with Comment is too long (maximum is 65536 characters) and all the data lost. It hurts.

Attached a file above.

@uladz-zubrycki
Copy link
Author

@zkat here you go. Pls, let me know if it's just me doing it the wrong way.

@zkat zkat added Triage:NeedsTriageDiscussion Priority:1 High priority issues that must be resolved in the current sprint. and removed Triage:Untriaged labels Oct 4, 2021
@zivkan
Copy link
Member

zivkan commented Oct 4, 2021

Is this a duplicate of #10791 which has not yet been released GA?

@uladz-zubrycki
Copy link
Author

@zivkan it is imo, but I was asked to file it separately.

Errorneous behavior is slightly different though, so it could be beneficial at least from the discoverability point.

@zkat
Copy link
Contributor

zkat commented Oct 4, 2021

I don't know if it's a duplicate. This looks like it might be hitting a different code path? We'll see.

@zkat zkat self-assigned this Oct 4, 2021
@zkat
Copy link
Contributor

zkat commented Oct 4, 2021

GenerateNuspec:
  Successfully created package 'C:\Users\kmarchan\src\NugetReadmeRepro\bin\Release\NugetReadmeRepro.1.0.0.nupkg'.

  Attempting to build symbols package for 'NugetReadmeRepro.csproj'.
  Successfully created package 'C:\Users\kmarchan\src\NugetReadmeRepro\bin\Release\NugetReadmeRepro.1.0.0.snupkg'.
Done Building Project "C:\Users\kmarchan\src\NugetReadmeRepro\NugetReadmeRepro.csproj" (pack target(s)).

I've confirmed that this is fixed in the latest 6.0, so I'm gonna close this. Thanks for bearing with my paranoia :)

@zkat zkat closed this as completed Oct 4, 2021
cinderblocks added a commit to cinderblocks/libremetaverse that referenced this issue Jan 5, 2022
JasonElkin added a commit to JasonElkin/Emptiness that referenced this issue Apr 1, 2022
vivet pushed a commit to Nano-Core/Nano.Library that referenced this issue Apr 23, 2022
@DreadLordMikey
Copy link

When you say this "is fixed in the latest 6.0", what exactly are you referring to? .NET 6.0? NuGet? Something else?

Our Azure build pipelines are using dotnet pack, and this is still impacting us. When was this update released, and what update was it released in? I need to communicate this information to my superiors, as it's a blocking issue for us.

@grothag
Copy link

grothag commented Jun 23, 2022

This is not fixed.

@cpereira-utad
Copy link

Just had this issue as well. I have selected the readme file through the project properties on Visual Studio 2022 17.1.1, which by default added this section to my .csproj

<None Update="README.md">
  <Pack>True</Pack>
  <PackagePath>\</PackagePath>
</None>

I have solved it by changing "Update" to "Include":

<None Include="README.md">
  <Pack>True</Pack>
  <PackagePath>\</PackagePath>
</None>

@SlimeNull
Copy link

SlimeNull commented Feb 4, 2023

Just had this issue as well. I have selected the readme file through the project properties on Visual Studio 2022 17.1.1, which by default added this section to my .csproj

<None Update="README.md">
  <Pack>True</Pack>
  <PackagePath>\</PackagePath>
</None>

I have solved it by changing "Update" to "Include":

<None Include="README.md">
  <Pack>True</Pack>
  <PackagePath>\</PackagePath>
</None>

Thank you, it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:1 High priority issues that must be resolved in the current sprint. Triage:NeedsTriageDiscussion Type:Bug
Projects
None yet
Development

No branches or pull requests

7 participants