portable-class-library

Why can't I reference System.Net.Sockets in a Portable Class Library using Xamarin?

旧巷老猫 提交于 2019-11-30 14:04:53
I am trying to use System.Net.Sockets API in a portable class library so that my projects can reuse code for socket connections. But I cannot reference that namespace in my code. As I understand it, PCLs limit you to assemblies that are available on all targeted platforms. But I am targeting ios, Android, and .Net 4.5 (using Xamarin), and all of these should have the system.dll assembly that contains the API. What am I missing? As it is right now, there is no PCL profile targeting only .NET Framework (4/4.03/4.5/4.5.1) Xamarin.Android Xamarin.iOS If you for example attempt to define a Portable

Why can't I call Delegate.CreateDelegate in my Portable Class Library?

微笑、不失礼 提交于 2019-11-30 13:23:10
问题 I have the following problem: I want to call Delegate.CreateDelegate from within my Portable Class Library targeting .NET 4.5, Windows Phone 8 and Windows 8 Store Apps, but my code does not compile. The compiler says that it cannot find the method on the Delegate type. The funny thing is that e.g. the PRISM library by Microsoft can call 'Delegate.CreateDelegate' from a Portable Class Library. It does so in the DelegateReference class. The PRISM portable class library targets .NET 4.0, Windows

Is it possible to use a Portable Class Library that references System.Net in MonoDroid?

南楼画角 提交于 2019-11-30 13:07:33
Following from How can I build a targetting pack for Portable Class Libraries? and the advice in http://jpobst.blogspot.com/2012/04/mono-for-android-portable-libraries-in.html I've managed to build some monodroid example programs which use Portable Class Libraries. However, if any of my input PCLs reference the System.Net assembly, then monodroid fails to package my apk - because it complains about File Not Found for System.Net.dll. As I understand it (from http://docs.xamarin.com/android/about/assemblies ), MonoDroid bundles all the System.Net functionality inside System.dll. Is there any way

Xamarin Shared Projects vs Portable class libraries

浪子不回头ぞ 提交于 2019-11-30 12:33:09
问题 I am trying to figure out which is the better way to go for our project. PCL Library or Shared Project by Xamarin. In the Xamarin documentation link here it says that a rule of thumb is to choose shared project when we will not share the library. The shared project can be written with #if's to make sure it works with multiple platforms - this also causes some issues with refactoring #ifs not active. Yet I have a gut feeling it is not right to put this code to a shared class. If a code that is

Convert async lambda expression to delegate type System.Func<T>?

主宰稳场 提交于 2019-11-30 12:32:17
问题 I have an async method inside a portable class library with this signature: private async Task<T> _Fetch<T>(Uri uri) It fetches a resource that is cast back as a concrete type T. I'm working with a 3rd party cache library (Akavache) that requires a Func<T> as one of the parameters and have tried to do so in this manner: await this.CacheProvider.GetOrCreateObject<T>(key, async () => await _Fetch<T>(uri), cacheExpiry); This results in the error: Cannot convert async lambda expression to

How should i use Azure Mobile Services with PCL or without it now?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-30 12:02:00
I updated to latest version of Xamarin, where PCL is "fully supported". How can i use Azure Mobile Services now? if i create PCL lib and trying to add it with NuGet it failed to install "Newtonsoft.Json 5.0.8" because it needs "portable-net45+wp80+MonoAndroid10+MonoTouch10" which is missing. if i create simple android lib and add Azure from components it's generate excepton: System.InvalidOperationException: A Windows Azure Mobile Services assembly for the current platform was not found. Ensure that the cur… on public static MobileServiceClient MobileService = new MobileServiceClient( "https:/

Density of screen in iOS and Universal WIndows App

不想你离开。 提交于 2019-11-30 11:39:47
Hi I need to know the density of screen in windows 10/8/8.1 and iOS. I got screen density in Android using DisplayMetrics but I find no such option/property available in UWP and iOS. So Is there any property through which I can get screen density in UWP and IOS. Matthew Regul UPDATE - June 8th 2018 Xamarin has released Xamarin.Essentials! Xamarin.Essentials provides developers with cross-platform APIs for their mobile applications. Android, iOS, and UWP offer unique operating system and platform APIs that developers have access to all in C# leveraging Xamarin. Xamarin.Essentials provides a

ConfigurationManager and AppSettings in universal (UWP) app

家住魔仙堡 提交于 2019-11-30 11:02:49
I would like to store an API key in a configuration file without checking it into source control, and read the data in my UWP app. A common solution is to store the key in .config file (such as app.config or web.config ) and access it like so: var apiKey = ConfigurationManager.AppSettings.Get("apiKey"); I'm working on a Universal Windows (UWP) app and can't access the System.Configuration namespace that holds ConfigurationManager . How can I access AppSettings in UWP app? Alternatively, what's the best way to access configuration data in an UWP app? Amadeusz Wieczorek In my specific use case I

.Net 2015 References with yellow triangle for Nuget packages on portable libraries

十年热恋 提交于 2019-11-30 10:52:35
I know the question has been asked before but none of the suggested resolutions are working for me so I'm going to ask it again and hopefully get new suggestions. Some of the articles I've read: VS .Net References with yellow triangle Why do I get a warning icon when I add a reference to an MEF plugin project? The exclamation mark in the yellow triangle icon (inside Solution Explorer) My 5 portable libraries are definitely all targeting the same frameworks (I've checked and re-checked as this was one of the suggestions!): .NET Framework 4.5 ASP.NET Core 1.0 Windows Phone 8 Windows Phone 8.1

Portable Class Library strong assembly reference problems in MonoTouch/MonoDroid

混江龙づ霸主 提交于 2019-11-30 09:12:52
问题 PCLs do work well in MonoTouch and MonoDroid. However, sometimes, when I use a variable to reference a Type in a PCL, and then I try to use that same reference in a MonoX client, then the compiler fails with a message like: The type 'System.Collections.Specialized.INotifyCollectionChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Windows, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'. The problem here