1

新的UWP项目(以10586或AU版本为目标,无所谓)。 当安装包Google.Apis 1.20(或其它版本)project.lock.json包含以下行:NuGet恢复/安装/锁定UWP应用程序的无效dll变体

{ 
    "version": 2, 
    "targets": { 
    "UAP,Version=v10.0": { 
     "Google.Apis/1.20.0": { 
     "type": "package", 
     "dependencies": { 
      "Google.Apis.Core": "1.20.0", 
      ...   
      "System.Threading.Tasks": "4.0.11" 
     }, 
     "compile": { 
      "lib/win81/Google.Apis.PlatformServices.dll": {}, 
      "lib/win81/Google.Apis.dll": {} 
     }, 
     "runtime": { 
      "lib/win81/Google.Apis.PlatformServices.dll": {}, 
      "lib/win81/Google.Apis.dll": {} 
     } 
     }, 

我很奇怪,为什么编译/运行节点所引用的lib/win81而package itself包含netstandard1.3文件夹。

如果我安装了Google.Apis.Core,它从此包中引用netstandard1.3个dll,而仍然从Google.Apis中获取win81个dll。

想知道,为什么是这样以及如何强制它使用netstandard1.3呢?


这里是封装的结构和nuspec:

Google Apis package tree

<?xml version="1.0" encoding="utf-8"?> 
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd"> 
    <metadata> 
    <id>Google.Apis</id> 
    <version>1.20.0</version> 
    <title>Google APIs Client Library</title> 
    <authors>Google Inc.</authors> 
    <owners>google-apis-packages</owners> 
    <requireLicenseAcceptance>false</requireLicenseAcceptance> 
    <licenseUrl>http://www.apache.org/licenses/LICENSE-2.0</licenseUrl> 
    <projectUrl>https://developers.google.com/api-client-library/dotnet</projectUrl> 
    <description>The Google APIs Client Library is a runtime client for working with Google services. 
      The library supports service requests, media upload and download, etc. 

      Supported Platforms: 

      - .NET Framework 4.5 and 4.6 

      - NetStandard1.3 

      - Windows 8 Apps 

      - Windows Phone 8 and 8.1 

      - Portable Class Libraries</description> 
    <tags>Google</tags> 
    <dependencies> 
     <group> 
     <dependency id="Google.Apis.Core" version="1.20.0" /> 
     <dependency id="Zlib.Portable.Signed" version="1.11.0" /> 
     </group> 
     <group targetFramework=".NETFramework4.5"> 
     <dependency id="log4net" version="2.0.3" /> 
     <dependency id="Google.Apis.Core" version="1.20.0" /> 
     <dependency id="Zlib.Portable.Signed" version="1.11.0" /> 
     </group> 
     <group targetFramework=".NETStandard1.3"> 
     <dependency id="Google.Apis.Core" version="1.20.0" /> 
     <dependency id="System.Collections" version="4.0.11" /> 
     <dependency id="System.Diagnostics.Debug" version="4.0.11" /> 
     <dependency id="System.IO" version="4.1.0" /> 
     <dependency id="System.IO.Compression" version="4.1.0" /> 
     <dependency id="System.Linq" version="4.1.0" /> 
     <dependency id="System.Net.Http" version="4.1.0" /> 
     <dependency id="System.Net.Primitives" version="4.0.11" /> 
     <dependency id="System.Reflection" version="4.1.0" /> 
     <dependency id="System.Runtime" version="4.1.0" /> 
     <dependency id="System.Runtime.Extensions" version="4.1.0" /> 
     <dependency id="System.Text.Encoding" version="4.0.11" /> 
     <dependency id="System.Threading" version="4.0.11" /> 
     <dependency id="System.Threading.Tasks" version="4.0.11" /> 
     <dependency id="System.Reflection.TypeExtensions" version="4.1.0" /> 
     </group> 
    </dependencies> 
    </metadata> 
</package> 

回答

0

按照Google APIs Client Library 1.20.0 NuGet包的描述中,它支持后续平台:

  • .NET Framework 4.5和4.6

  • NetStandard1.3

  • 的Windows 8应用程序

  • 的Windows Phone 8和8.1

  • 便携式类库

Google APIs Core Client Library 1.20.0库。所以我们不确定这个软件包的所有功能是否支持UWP平台,但是它应该适用于UWP。我不确定为什么你需要改变Dll的引用,如果这个软件包可以用于UWP应用程序,如果你在使用这个软件包构建uwp应用程序时遇到问题,请尝试将.Net Core版本更新到5.2.2 project.json文件如下,它将成功构建,您可以尝试继续。

{ 
"dependencies": { 
    "Google.Apis": "1.20.0", 
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2" 
} 

无论如何,参考哪些dll取决于如何google-apis-packages队包库,我们不能直接改变它。 compile只是显示目录结构。如果你想强制改变它,你可能需要自己打包库,详情请参考Creating a Package。在我看来,你自己包装可能会很挑剔,这个包可能不能用于uwp。

+0

吴,谢谢你的回答。我的问题不是关于特定的软件包,而是总体上为什么NuGet选择使用win81 lib而不是netstandard13 lib。 –

+0

@AlexSorokoletov,它取决于发布者如何打包库。请参考上面已经提到的创建一个包。 –

+0

不幸的是,这不是我正在寻找的答案。我有确切的图书馆和确切的目标项目。 .nu​​spec中的哪一行触发NuGet或VS通过netstandard13使用win81库? –