使用稳定版本(Xamarin.Android 4.10.1),我发现它仍然很奇怪。我有以下设置:
(1) 配置文件 49 的 PCL 库(.net 4.5、Windows 8、Xamarin Android/iOS)。
(2) Xamarin.Android App 引用(1)。
如果从 Nuget 将 Rx 添加到两个项目,它会将“targetFramework="portable-net45+wp80+MonoAndroid10+MonoTouch10”添加到 packages.config 并添加对“packages\Rx-Core.2.1.30214.0\lib\Portable-Net45”的引用+WinRT45+WP8\System.Reactive.Core.dll" 到这两个项目。
(1) builds fine then, but (2) doesn't (missing system.runtime.interopservices.windowsruntime, as in the initial question).
Changing the Rx-path in (2) to "packages\Rx-Core.2.1.30214.0\lib\net40\System.Reactive.Core.dll" however works, though (2) still references (1).
I had a look into the Rx code. References to System.Runtime.InteropServices.WindowsRuntime are guarded by #if HAS_WINRT, so I guess a library that relies on WinRT shouldn't have been put into a Xamarin.Android project by NuGet in the first place.
It's okay for me to change references manually, don't know what will happen if Rx gets an update.
But why is it ok to have the wrong dll in the PCL-project (1) and let (2) reference (1) ?