dotnet pack "The element <package> is unrecognized"

dotnet pack does support nuspec files. However, you have to pass them a couple specific configuration flags and add a dependency to your project. See the documentation here: https://learn.microsoft.com/en-us/nuget/reference/msbuild-targets#packing-using-a-nuspec


dotnet pack doesn't support packing nuspec files. It only supports msbuild projects that contain a Pack target.

You can create a csproj project and use the NuspecFile property or use nuget pack through a nuget.exe version from http://nuget.org/downloads or through a nuget executable provided by the mono framework on non-windows platforms.