dotnet pack - Missing Version / NU5017 Cannot Create Package
A dotnet pack failed to produce a valid .nupkg - either the package version is missing/invalid, or the project has no packable content. NU5017 and version errors stop the pack before a package is written.
What this error means
dotnet pack fails with NU5017 ("no dependencies nor content"), an invalid version error, or produces a package with an unexpected version. It is deterministic and tied to the project’s pack settings.
error NU5017: Cannot create a package that has no dependencies nor content.
# or
error: '1.0.0.0.0' is not a valid version string.Common causes
Missing or invalid package version
No Version/PackageVersion is set (or an injected CI version is malformed), so pack cannot stamp a valid SemVer onto the package.
Project has nothing packable
The project produces no library output or content to pack (e.g. a project not meant to be packed, or IsPackable left default on an empty project), triggering NU5017.
How to fix it
Set a valid package version
Provide a valid SemVer via the project or the pack command (e.g. from CI).
dotnet pack -c Release -p:PackageVersion=1.4.0 -o ./artifacts
# or in the project:
# <PropertyGroup><Version>1.4.0</Version></PropertyGroup>Mark the project packable with content
Ensure the project is intended to be packed and has output/content.
<PropertyGroup>
<IsPackable>true</IsPackable>
<PackageId>Contoso.MyLib</PackageId>
</PropertyGroup>How to prevent it
- Inject a valid SemVer version in CI (e.g. from a git tag) for every pack.
- Set
IsPackable=falseon apps/tests so only intended libraries pack. - Validate the produced
.nupkg(id + version) as a CI artifact step.