I am developing a windows phone app and an android app. Both the apps are under one visual studio 2010 solution.
I wanted to include a third project under the same solution which contains common functionality that both windows and android app uses. So, for this when I use plain 'Class Library' and when I try to reference that in windows phone app project, it says "Unable to add the selected project reference. The project reference must be another Silverlight for Windows Phone project that is same or lower version".
Which type of project do you suggest, so that I can use it windows phone and android projects?
You will have to use two different csproj files - because the build targets and other pieces will be different for the two platforms. Use this recursive include in each csproj to add the sources from a common location.
You can also try to use the Portable class library extension but I'm not sure if it will help.
Related
I am a newbie working with Xamarin Forms in Visual studio 2019.
When I create a blank page for Mobile App(Xamarin.Forms) , I do not see a Xamarin.forms portable template app in my project solution.
There is no PCL anymore. PCL is outdated. Just use the Mobile App (Xamarin.Forms) template. It will create all you need.
The core project (that contains your shared code) will be a .net standard project.
.net standard is way better than PCL, because you don't have a artificially limited set of APIs.
this creates the following 3 projects
Your shared code should go into the App8 project
How to add a library for Windows to cross-platform Xamarin project in Visual Studio?
Example, we have some 3rd party service with API and DLL binaries for this API. The service provides DLL for WP, Android, iOS and .NET, but not for Xamarin. Can I use it for Xamarin.Android и Xamarin.iOS?
I have tried to connect WP or .NET DLL to the projects, but it doesn't work.
I have done something similar.
I created a libs folder under my Droid project and placed the Android-specific libraries in there.
I then added the DLL's to my project (using the Add Files option) and, this is important, changed the Build action to EmbeddedResource.
From there, I could access the packages as expected and work with the library.
I'm a bit confused about the dlls that are installed when using Nuget to install libraries to my Xamarin Projects. I mainly manage the nugets for the whole solution. So when i install a nuget i choose all platform projects as targets, meaning the PCL, the Android and the iOS Project. In most cases there are different dlls, like #.XForms, #.XForms.Android and #.Android, for example in the Community Toolkit (FormsCommunityToolkit), which is also available from Nuget.
In my understanding the .Android dlls need to be used in the android platform project, and the XForms dll without android should be used in the PCL. A good example is the Converters.dll. That's code only used in the pcl, but the dll is also automatically referenced in the platform projects. So my question is, why is this the case?
I see this behavior not only for this toolkit but also for other apis, like Syncfusion.
PCL dlls will contain codes that accessing common API for the targeted PCL profiles. For the UI project (Android and iOS) need to be using different dlls most of the time because it need to access to platform specific APIs. For example, API to check network connection is different in iOS and Android.
But you should not be worry about which dlls to use. NuGet package manager already handle which dlls to be use in the solutions. So, you will just need to include the packages and let the package manager to handle the rest of it.
I have currently a WP8.1 and a Win8.1 pair of apps laying in a solution.
I am trying to create a best-possible scenario in which:
I can keep the 8.1 and wp8.1 projects still buildable
I can add a uwp project(to the old solution) that uses the (linked?) files from the above projects
Is this even possible, or should I branch from the 8.1, create the uwp, create new UI, copy/paste the code?
Just add a new project to the old solution and reference the 8.1 Universal App project. If you factored out enough code into the Shared project, you should be in for an easy migration.
I have installed Windows 8 and Visual Studio 11 to develop metro style apps. But each time i try to create Metro app project the projects get created but in reference there is nothing added but the project builds successfully and even its not allowing me to add any reference dll.
What are you adding a reference to? Metro style apps can only add references to other Metro style class libraries or portable class libraries.
Metro style applications targets .NETCore framework if dependent solution is built on .NetFramework it can't be used in Metro style apps. For now you cannot rebuild your .NETFramework libraries on .NETCore because it has limited access(only for Windows Store apps).