question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"dotnet pack" does not build

See original GitHub issue

According to the documentation (https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-pack) the command dotnet pack should first build the project, unless the option --no-build is specified.

I am using Github Actions to publish my nuget project. And in my yml after setting up the environment and checking out the code I run the command dotnet pack --configuration Release -o output, which worked fine before but after my latest changes (renaming files, no changes to the yml) it fails with

##[error]/opt/hostedtoolcache/dncs/3.1.101/x64/sdk/3.1.101/Sdks/NuGet.Build.Tasks.Pack/build/NuGet.Build.Tasks.Pack.targets(198,5): error NU5026: The file ‘/home/runner/work/IvanStoychev.StringExtensions/IvanStoychev.StringExtensions/IvanStoychev.StringExtensions/bin/Release/netcoreapp3.0/IvanStoychev.StringExtensions.dll’ to be packed was not found on disk.

If I were to place a dotnet build command before the packing - it works fine.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:9
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

24reactions
egeaydincommented, Mar 1, 2021

I know this is an older issue but if someone is still having the same issue this worked for me: https://steveellwoodnlc.medium.com/error-nu5026-the-file-to-be-packed-was-not-found-on-disk-18bfbc6be4a

Simply remove this from your csproj file if you have it: <GeneratePackageOnBuild>true</GeneratePackageOnBuild>

4reactions
emaungcommented, Jun 27, 2022

I can confirm that this issue also exists on my mac running dotnet 6.0.301. I have library projects with <GeneratePackageOnBuild>true</GeneratePackageOnBuild> set. Setting <GeneratePackageOnBuild>false</GeneratePackageOnBuild> fixes the problem as suggested by @AntonSmolkov

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to "dotnet pack" an already compiled project
The reason for this is that the dotnet pack --no-build option will try to use the previously built output, but can't find it...
Read more >
dotnet pack command - .NET CLI
The dotnet pack command builds the project and creates NuGet packages. The result of this command is a NuGet package (that is, a...
Read more >
dotnet pack passing the directory does not work
I'm using Teamcity Enterprise (v 2019.1 (build 65998)) to create the NuGet package to be deployed with Octopus. My idea is to execute...
Read more >
Dotnet pack doesn't create nupkg
The build is ok, The pack command seems to work well, but the nuget push generate an error error: File does not exist...
Read more >
Dotnet pack - include referenced projects
Does this work with dotnet pack --no-build? I have a dedicated build step in my pipeline so the project dlls are already in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found