
Explanation

Step 1: Run the NuGet spec command
In the simple case of creating a package from an assembly, you can generate a .nuspec file from the metadata
in the assembly using the following command:
nuget spec <assembly-name>.dll
Step 2: Update the package identifier and version number
Choose a unique package identifier and setting the version number.
Step 3: Run the NuGet pack command
Running nuget pack to generate the .nupkg file
Step 4: Run theNuGet push command
Once you've created a package, which is a .nupkg file, you can publish it to the gallery of your choice. You
can publish with dotnet nuget push command
References:
https://docs.microsoft.com/en-us/nuget/create-packages/creating-a-package
https://docs.microsoft.com/en-us/nuget/create-packages/publish-a-package