1

So embarrassing to ask something that is that well documented, but I am lost with an error which I get when I push my NuGet package:

enter image description here

System.AggregateException: One or more errors occurred. ---> System.Net.Http.HttpRequestException: Response status code does not indicate success: 400 (The NuGet package contains an invalid .nuspec file. The error encountered was: 'The target framework Unsupported,Version=v0.0 is not supported.'. Correct the error and try again.).

I use the VSTS NuGet task to push the package to NuGet.org which delivers the aforesaid error. There's nothing customized, just the default settings:

In my nuspec file I have listed dependencies, simplified example:

<dependencies>
  <group targetFramework="netcoreapp">
    <dependency id="Microsoft.NETCore.App" version="2.0.0" exclude="Build,Analyzers" />
  </group>
  <group targetFramework="net462" />
  <group targetFramework="netstandard1.0" />
</dependencies>

I assume my targetFramework is set incorrectly yet it is as per documentation NuGet Target Frameworks. I tried target frameworks like netstandard and netcoreapp2.0, they all cause the same problem.

My package files:

<files>
  <file src="bin\MINE.Core.dll" target="lib\netcoreapp\MINE.Core.dll" />
  <file src="bin\MINE.Core.NetFX.dll" target="lib\net462\MINE.Core.NetFX.dll" />
  <file src="bin\MINE.Core.PCL.dll" target="lib\netstandard1.0\MINE.Core.PCL.dll" />
  <file src="readme.core.txt" target="" />
</files>

If I leave the dependencies section empty (<dependencies />) everything works perfectly fine except for the package doesn't list the dependencies which I'd like to include. Also, If I don't use groups and therefore don't target frameworks, but list all dependent packages, everything works fine.

Any hint to solve this (probably silly) issue would be warmly appreciated.

Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62
  • 1
    Try using a later version of NuGet than version 2. NuGet 2 does not know about .NET Standard. – Matt Ward Jan 29 '18 at 09:11
  • 1
    @MattWard he is using a later version of nuget than version 2. The "2" in the screenshot above is the version of the task that wraps nuget ;) this task uses version 4.0 if no previous nuget-installer task is used, otherwise it uses the version specified in the nuget-installer task. QualityCatalyst: Does your definition have the 'Nuget-Installer' task and which version is configured ? – D.J. Jan 29 '18 at 09:45
  • 1
    @D.J.Thanks for clarification. No, I only have the NuGet Push task as per screenshot which uses NuGet 4.1.0 as per documentation: https://learn.microsoft.com/en-us/vsts/build-release/tasks/package/nuget – Quality Catalyst Jan 29 '18 at 18:41
  • @MattWard: I updated the image to reflect that I use NuGet version 4.1.0. – Quality Catalyst Jan 29 '18 at 18:43
  • It seems that I can't reproduce this issue. What's the detail code of nuspec? What's the result if you push the package manually? Can you reproduce this issue with a new sample? – starian chen-MSFT Jan 30 '18 at 02:29
  • @starianchen-MSFT: What is a "nuspec detail code"? If you refer to the HTTP response message from the NuGet.org service this is a 400 BAD REQUEST - no detail code available as the logs of the NuGet task hide it. I don't push manually at all, but I have had hundreds of automated pushes in the past. To package I still use the now deprecated, but still working NuGet Packager task ... now thinking about it, I may have to change this. – Quality Catalyst Jan 30 '18 at 22:48
  • I mean the content in nuspec file. Can you share the detail log on the OneDrive (Set system.debug variable to true)? Can you reproduce this issue with a new sample? If so you can share the sample on the OneDrive. – starian chen-MSFT Jan 31 '18 at 02:29
  • Thank you! I got first indicators that using the deprecated NuGet Packager task, which creates the NuGet packages, creates an incompatible NuGet package since a few weeks ago. Investigating further and will report. If that's not the case, I'll be looking into providing a detailed log file. – Quality Catalyst Jan 31 '18 at 03:31

1 Answers1

0

The release definition isn't the problem, the build definition is. When the to be pushed NuGet package gets packed, ensure the correct NuGet version is being used.

For example, the deprecated NuGet Packager task in VSTS used to package uses internally an older version of NuGet. Therefore, replacing the VSTS task with the recommended NuGet task solves the problem and NuGet.org won't complain about incorrectly nuspec files anymore.

enter image description here

Quality Catalyst
  • 6,531
  • 8
  • 38
  • 62
  • @starianchen-MSFT: Thank you for asking the right questions. That triggered me to check the packaging process which turned out to have not been maintained to use the latest NuGet version 4.1.0. – Quality Catalyst Feb 01 '18 at 05:16