Unable to pack a Nuget Package on VSTS Unable to cast object of type 'System.String' to type 'NuGet.Frameworks.NuGetFramework'

In VSTS I used "dotnet pack" instead of "nuget pack". So this problem was resolved.

To publish nuget lib on VSTS, I choiced the following plugins sequence:

  • Get sources
  • nuget restore
  • dotnet build
  • dotnet pack
  • nuget push

Using Nuget 4.9.1 version resolved resolved my issue.

Using Nuget 4.9.1 version resolved my issue.


I had this same issue with my .net standard 2.0 class library I was pack into a nuget package. Here is a screenshot of the step you need to add to replace nuget pack step.

Step Type To Add Step Type To Add

Here is how I configured the step Here is how I configured the step