2017-04-25 50 views
1

我想添加一个自制的NuGet包,用Visual Studio 2017自动构建到UWP Xamarin Forms项目。Xamarin形式UWP未能引用NuGet包系统引用

NuGet Package Structure

然而,当我尝试了包添加到UWP包(在VS2017包管理器),它失败。

Restoring packages for C:\Development\MyMobile\JobApp\JobApp\JobApp.UWP\project.json... 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-arm). 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-arm-aot. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-arm-aot). 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-x64). 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x64-aot. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-x64-aot). 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-x86). 
System.Threading.ThreadPool 4.3.0 provides a compile-time reference assembly for System.Threading.ThreadPool on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. 
System.Threading.Thread 4.3.0 provides a compile-time reference assembly for System.Threading.Thread on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. 
System.Diagnostics.Process 4.3.0 provides a compile-time reference assembly for System.Diagnostics.Process on UAP,Version=v10.0, but there is no run-time assembly compatible with win10-x86-aot. 
One or more packages are incompatible with UAP,Version=v10.0 (win10-x86-aot). 
Package restore failed. Rolling back package changes for 'JobApp.UWP'. 
Time Elapsed: 00:00:02.8217814 
========== Finished ========== 

我已经编辑project.json为UWP项目,试图在netstandard1.6和系统中添加。*的依赖,但遗憾的是没有工作。

{ 
    "dependencies": { 
    "Microsoft.NETCore.UniversalWindowsPlatform": "5.3.3", 
    "MvvmLight": "5.3.0", 
    "Newtonsoft.Json": "10.0.2", 
    "Xamarin.Forms": "2.3.4.231", 
    "System.Threading": "4.3.0", 
    "System.Runtime": "4.3.0", 
    "System.Diagnostics.Process": "4.3.0", 
    "System.Threading.Thread": "4.3.0", 
    "System.Threading.ThreadPool": "4.3.0" 
    }, 
    "frameworks": { 
    "uap10.0": { 
     "imports": "netstandard1.6" 
    } 
    }, 
    "runtimes": { 
    "win10-arm": {}, 
    "win10-arm-aot": {}, 
    "win10-x86": {}, 
    "win10-x86-aot": {}, 
    "win10-x64": {}, 
    "win10-x64-aot": {} 
    } 
} 

为什么UWP在System。*引用中遇到问题?

这是我的包的NuSpec;

<?xml version="1.0" encoding="utf-8"?> 
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd"> 
    <metadata> 
     <id>MyCommon</id> 
     <version>1.0.131</version> 
     <requireLicenseAcceptance>false</requireLicenseAcceptance> 
     <dependencies> 
      <group targetFramework=".NETFramework4.6"> 
       <dependency id="Quartz" version="3.0.0-alpha2" exclude="Build,Analyzers" /> 
       <dependency id="ImageSharp" version="1.0.0-alpha5-00046" exclude="Build,Analyzers" /> 
       <dependency id="System.ComponentModel" version="4.3.0" exclude="Build,Analyzers" /> 
      </group> 
      <group targetFramework=".NETStandard1.6"> 
       <dependency id="Quartz" version="3.0.0-alpha2" exclude="Build,Analyzers" /> 
       <dependency id="NETStandard.Library" version="1.6.1" exclude="Build,Analyzers" /> 
       <dependency id="ImageSharp" version="1.0.0-alpha5-00046" exclude="Build,Analyzers" /> 
       <dependency id="System.ComponentModel" version="4.3.0" exclude="Build,Analyzers" /> 
      </group> 
     </dependencies> 
    </metadata> 
</package> 
+0

你能提供'.nuspec'文件吗? –

+0

修改了我的问题,谢谢 – wonea

回答

2

你的NuGet包被引用Quartz 3.0.0-alpha2,它引用System.Threading.ThreadSystem.Threading.ThreadPool

这两个软件包(System.Threading.ThreadSystem.Threading.ThreadPool)在通用Windows平台上不受支持,至少现在不支持。

Here,IMMO Landwerth(在.NET团队项目经理)说:

  • UWP目前只支持.NET 1.4标准
  • 我们的目标是最终 延长UWP,也能实现。 NET标准2.0。一旦发生 ,UWP也将支持Thread

这里有一些GitHub的问题,在这里你可以阅读更多关于这个话题:

+0

非常丰富,谢谢!不支持.NET Standard 1.6的UWP令人沮丧,这意味着我们的Windows Mobile支持将被延迟。 – wonea