Skip to main content

Posts

Showing posts from January, 2019

Azure Devops .Net Core and .Net Standard NuGet Pack/Push

NuGet pack Unable to cast object of type 'System.String' to type 'NuGet.Frameworks.NuGetFramework

Came across a rather misleading error message above today while attempting to pack and publish a .Net Standard class library project to a private feed as a DevOps Artifact.




Well, it turns out that the NuGet Pack and NuGet Push are not supported by NuGet 4.x at this time. The workaround is to use the .Net core specific build tasks which include commands for pack and publish as show below:




YAML -(PACK) steps: - task: DotNetCoreCLI@2   displayName: 'dotnet pack'   inputs:     command: pack     packagesToPack: <your project.csproj>     versioningScheme: byPrereleaseNumber -(PUSH) steps: - task: DotNetCoreCLI@2 displayName: 'dotnet push' inputs: command: push packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;! $(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg' publishVstsFeed: '<your feed id>'

The other interesting poin…