为什么我的Nuget库不能从.NetStandard 2.0获得?

为什么我的Nuget库不能从.NetStandard 2.0获得?,nuget,nuspec,Nuget,Nuspec,我用以下Nuspec创建了Nuget“Uplink.NET”: <?xml version="1.0" encoding="utf-8"?> <package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd"> <metadata> <id>uplink.NET</id> <version>1.3.1</version

我用以下Nuspec创建了Nuget“Uplink.NET”:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/01/nuspec.xsd">
  <metadata>
    <id>uplink.NET</id>
    <version>1.3.1</version>
    <title>Connector to the storj-network</title>
    <authors>TopperDEL,Storj Labs Inc.</authors>
    <owners>TopperDEL,Storj Labs Inc.</owners>
    <requireLicenseAcceptance>false</requireLicenseAcceptance>
    <projectUrl>https://github.com/TopperDEL/uplink.net</projectUrl>
    <iconUrl>https://storj.io/press-kit/Storj-symbol.png</iconUrl>
    <description>This library provides access to the secure and decentralised Storj-network. It allows you to:
- create and delete buckets
- upload and download files

It is - like Storj itself - open source and developed on GitHub.</description>
    <releaseNotes>Initial release</releaseNotes>
    <copyright>(c) 2019 TopperDEL, Storj Labs Inc.</copyright>
    <tags>storj tardigrade storage decentralised secure bucket file xamarin android</tags>
    <repository type="git" url="https://github.com/TopperDEL/uplink.net.git" />

    <contentFiles>
      <files include="uplink.NET\bin\release\netstandard2.0\storj_uplink.dll" buildAction="None" copyToOutput="true" flatten="true" />
    </contentFiles>
  </metadata>
  <files>
    <file src="uplink.NET.targets" target="build\uplink.NET.targets" />
    <file src="uplink.NET.Droid\bin\Release\uplink.NET.Droid.dll" target="lib\MonoAndroid7.0\uplink.NET.Droid.dll" />
    <file src="uplink.NET.Droid\bin\Release\uplink.NET.Droid.dll" target="lib\MonoAndroid7.1\uplink.NET.Droid.dll" />
    <file src="uplink.NET.Droid\bin\Release\uplink.NET.Droid.dll" target="lib\MonoAndroid8.0\uplink.NET.Droid.dll" />
    <file src="uplink.NET.Droid\bin\Release\uplink.NET.Droid.dll" target="lib\MonoAndroid8.1\uplink.NET.Droid.dll" />
    <file src="uplink.NET.Droid\bin\Release\uplink.NET.Droid.dll" target="lib\MonoAndroid9.0\uplink.NET.Droid.dll" />
    <file src="uplink.NET\bin\Release\netstandard2.0\uplink.NET.dll" target="lib\netstandard2.0\uplink.NET.dll" />
    <file src="uplink.NET\bin\Release\netstandard2.0\uplink.NET.dll" target="netstandard2.0\uplink.NET.dll" />
    <file src="uplink.NET\bin\Release\netstandard2.0\uplink.NET.dll" target="lib\uap10.0.16299\uplink.NET.dll" />
    <file src="uplink.NET\storj_uplink.dll" target="storj_uplink.dll" />
  </files>
</package>

上行链路.NET
1.3.1
连接到storj网络的连接器
托珀德尔,斯托尔实验室公司。
托珀德尔,斯托尔实验室公司。
假的
https://github.com/TopperDEL/uplink.net
https://storj.io/press-kit/Storj-symbol.png
此库提供对安全且分散的Storj网络的访问。它允许您:
-创建和删除存储桶
-上传和下载文件
它就像Storj本身一样,是开源的,是在GitHub上开发的。
首次发布
(c) 2019年托珀德尔,斯托杰实验室公司。
storj tardigrade存储分散式安全存储桶文件xamarin android
我可以将其添加到NetStandard2.0类库中,但它会作为PackageReference添加,并包含以下条目:

<PackageReference Include="uplink.NET" Version="1.3.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>

全部的
运行时间;建设;本地人;内容文件;分析仪;可传递的
我现在无法访问库中的对象。但同样的Nuget正在与Xamarin、Android和UWP合作


有人能帮忙吗?

是的,当包是开发依赖项时,如:

对于PackageReference(NuGet 4.8+),此标志还意味着它将 从编译中排除编译时资产

另一种解释是:

当包的developmentDependency为true时,设置PrivateAssets 到所有和排除要在中的PackageReference项上编译的资产 项目,而:

  • 通过VS NuGet UI或PMC安装软件包
  • 执行dotnetadd package命令将现有项目从packages.config迁移到 包装参考
即使开发依赖性是正确的,也不要做任何事情,将其视为正常 PackageReference,而:

  • 在项目中手动添加PackageReference项以添加包
  • 将现有VS实例从以前的版本升级到最新版本(已开始支持开发依赖关系)

删除
私有资产
包括资产
。是的,它会起作用。但是为什么它会从我的Nuget/Nuspec添加到PackageReference中呢?我怎样才能阻止它被自动添加?好吧,看起来,这不是一个bug,而是一个特性。我意外地将我的nuget标记为developmentDependency,如下所述:你到底为什么需要一个.nuspec?通过一个基于多目标SDK的项目,它可以自动生成一个NuGet包(这也避免了可能的错误(如痛苦的
内容文件
).嗯-老实说,我不是这方面的专家。但我有两个项目-一个是Xamarin.Android,一个是NetStandard,我想把这两个项目都包括在我的Nuget中。我真的不知道如何做到这一点。我对任何人都感兴趣-这个项目是开源的,我感谢PRs:谢谢你完成它!