"dotnet pack" does not build
See original GitHub issueAccording 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:
- Created 3 years ago
- Reactions:9
- Comments:17 (4 by maintainers)
Top GitHub Comments
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>
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