简体   繁体   中英

Visual Studio Nuget Manager reports “unsupported” for the .NETStandard2.0 section of a custom Nuget

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软件包管理器

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM