C
C#2d ago
Core

✅ dotnet pack command fails

Hello, I'm trying to package a library, but dotnet pack fails to create the package. The docs says I should build the project it beforehand, or not use the --no-build flag, but I didn't specify the flag. https://learn.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu5026
c#
dotnet pack src/UaDetector --configuration Release --output packages
c#
dotnet pack src/UaDetector --configuration Release --output packages
The file '/home/runner/work/UaDetector/UaDetector/src/UaDetector/bin/Release/net462/UaDetector.dll' to be packed was not found on disk.
The file '/home/runner/work/UaDetector/UaDetector/src/UaDetector/bin/Release/net462/UaDetector.dll' to be packed was not found on disk.
Below is the .csproj file
c#
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;net462;net6.0;net8.0;</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>UaDetector</PackageId>
<Version>1.0.0-preview.1</Version>
<Authors>Bill</Authors>
<RepositoryType>git</RepositoryType>
/PackageTags>
</PropertyGroup>
c#
<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>netstandard2.0;net462;net6.0;net8.0;</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>UaDetector</PackageId>
<Version>1.0.0-preview.1</Version>
<Authors>Bill</Authors>
<RepositoryType>git</RepositoryType>
/PackageTags>
</PropertyGroup>
NuGet Error NU5026
NU5026 Error code
4 Replies
canton7
canton72d ago
I wonder whether GeneratePackageOnBuild might be messing it up?
Core
CoreOP2d ago
Yes... That was the problem Thank you so much Why is that option even available if it messes with packaging...
canton7
canton72d ago
Lol, what a guess My guess is that it causes the package to happen on build just fine... But breaks a explicit package? See if there's an open issue for it
Core
CoreOP2d ago
There was apparently an issue, and this is by design: https://github.com/NuGet/Home/issues/11691#issuecomment-1085102122

Did you find this page helpful?