简体   繁体   English

Visual Studio Nuget Manager报告自定义Nuget的.NETStandard2.0部分“不支持”

[英]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: 我们有一个.NetStandard2.0项目,它打算按照此处说明的技术打包到一个nuget中:

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

with a nuspec file which looks like so: 带有一个如下所示的nuspec文件:

    <?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. 如您所见,有一个针对.NetStandard2.0的部分。 The nuget package is generated by our build server using the following msbuild scriptlet: nuget软件包是由我们的构建服务器使用以下msbuild脚本生成的:

    <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软件包将被推送到具有以下规格的nuget服务器中:

    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: 通过.Net4.8项目的Visual Studio 2017 Nuget软件包管理器查看软件包时,边栏上将显示以下内容:

Nuget软件包管理器

Why does it say "Unsupported" for the .NetStandard2.0 section? 为什么对.NetStandard2.0部分说“不支持”? Other packages don't display something like that and I can't find see any typos in the xml of the nuspec. 其他软件包没有显示类似的内容,我在nuspec的xml中找不到任何错别字。

I've just found your issue could be related to the version of Nuget.Server package since you don't use nuget pack command. 我刚刚发现您的问题可能与Nuget.Server软件包的版本有关,因为您不使用nuget pack命令。 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. 使用相同的nuget包,当我使用Nuget.server 2.10.3时 ,它显示不受支持。将Nuget.server更新到3.4.1之后,现在一切正常。 Let me know if it helps:) 让我知道是否有帮助:)

I made a package locally, when I try to consume it in VS all works well. 当我尝试在VS中使用它时,我在本地制作了一个包,效果很好。 After I deploy same package to nuget server 2.10.3, it displays unsupported ! 将相同的程序包部署到nuget服务器2.10.3后,它显示不受支持

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! 我认为这是因为您使用的Nuget.Server软件包太旧了! Updating the Nuget.Server package can help resolve this issue. 更新Nuget.Server软件包可以帮助解决此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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