0

We have a .NetStandard2.0 project which is meant to be packaged into a nuget following the technique explained here:

     https://stackoverflow.com/a/45004898/863651

with a nuspec file which looks like so:

    <?xml version="1.0" encoding="utf-8"?>
    <package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
      <!-- https://stackoverflow.com/a/45004898/863651   we had to resort to employing a seperate nuspec -->
      <!-- file because thats the canonical way to include more than one dlls into the resulting nuget   -->
      <metadata>
        <id>$id$</id>
        <tags>$tags$</tags>
        <owners>$owners$</owners>
        <version>$version$</version>
        <authors>$authors$</authors>
        <description>$description$</description>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <dependencies>
          <group targetFramework=".NETFramework4.5">
          </group>
          <group targetFramework=".NETStandard2.0">
              <dependency id="Newtonsoft.Json" version="12.0.1" exclude="Build,Analyzers" />
          </group>
        </dependencies>
        <frameworkAssemblies>
          <frameworkAssembly assemblyName="System" targetFramework=".NETFramework4.5" />
          <frameworkAssembly assemblyName="Microsoft.CSharp" targetFramework=".NETFramework4.5" />
        </frameworkAssemblies>
      </metadata>
      <files>
        <file src="bin\$config$\netstandard2.0\*.dll;bin\$config$\netstandard2.0\*.pdb;" target="lib\netstandard2.0\" />
      </files>
    </package>

As you can see there is a section targeting .NetStandard2.0. The nuget package is generated by our build server using the following msbuild scriptlet:

    <MSBuild Projects="C:\path\to\foo.csproj" Targets="Clean;foo;" Properties="SkipRestoringNugetPackages=true;Configuration=Release;Platform=AnyCPU;" ToolsVersion="15.0" />

The resulting nuget package is getting pushed into a nuget server with the following specs:

    NuGet.Server v2.10.3.0

When reviewing the package through Visual Studio 2017 Nuget Package Manager of a .Net4.8 project the following is displayed on the sidebar:

Nuget Package Manager

Why does it say "Unsupported" for the .NetStandard2.0 section? Other packages don't display something like that and I can't find see any typos in the xml of the nuspec.

XDS
  • 3,786
  • 2
  • 36
  • 56

1 Answers1

2

I've just found your issue could be related to the version of Nuget.Server package since you don't use nuget pack command. With same nuget package, when I use Nuget.server 2.10.3, it displays unsupported, After I update the Nuget.server to 3.4.1, all works well now. Let me know if it helps:)

I made a package locally, when I try to consume it in VS all works well. After I deploy same package to nuget server 2.10.3, it displays unsupported!

So if the issue occurs when you try to fetch the package from the server after you deploy to it. I think it's because the Nuget.Server package you use is too old! Updating the Nuget.Server package can help resolve this issue.

LoLance
  • 25,666
  • 1
  • 39
  • 73
  • Thank you for tuning in. As I said I'm using the msbuild task directly while the option "Generate Nuget Package on Build" is checked. I am using MSBuild from C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe (version 15.9.21). Makes me wonder which nuget version MSBuild is using. – XDS Sep 12 '19 at 10:16
  • @XDS NuGet.Server v2.10.3.0 is quite old, try updating it to latest 3.4.1 to check if it makes any difference:) – LoLance Sep 12 '19 at 12:01
  • 1
    @XDS Ok, I've just found your issue is related to the version of Nuget.Server package since you don't use nuget pack command. With same nuget package, when I use nuget.server 2.10.3, it displays unsupported, After I update the Nuget.server to 3.4.1, all works well now. Let me know if it helps:) – LoLance Sep 12 '19 at 12:20
  • Please update your answer so that I can accept it. This will help people who come here figure out what's wrong without looking at the comments. Thank you again! – XDS Sep 12 '19 at 13:14
  • @LoLance - I have `netstandard2.0` and Nuget.server 3.4.1. Still shows unsupported version. Any idea what am I missing? – YK1 May 18 '22 at 04:47