Add Windows Phone platform support to existing C# project - c#

I have an opes-source project which I want to use on Windows Phone. Currently it targets one of the following: Any CPU, x86 or x64. Apparently, when I build and try to use the output as a reference in a Windows Phone project, I'm getting an error: A reference to a higher version or incompatible assembly cannot be added to the project.
I'm trying to build that open-source project so that it would target Windows Phone platform. To achieve that, I'm trying to find a way to add Windows Phone platform somewhere in VS project's settings, but with no luck. Is it possible at all? If yes, how?
Thanks.

Related

Is it possible to add a System.windows.form reference to a Xamarin project?

I am developing a Xamarin.Forms app in Visual Studio and I need to use an external SDK that is dedicated for Windows Form apps. I have been trying to add a reference to System.Windoes.Form but it doesn't appear in the assemblies.
I know it wouldn't make sense using windows forms in a Xamarin project, but I am creating the user interface with Xamarin graphics, I just need to add the reference to Windows.Forms to get rid of the following error:
Can not resolve reference: System.Windows.Forms, referenced by MY DLL. Please add a NuGet package or assembly reference for System.Windows.Forms, or remove the reference to MYDLL.
Is there a way to do so?
Thanks
.NET can be categorized into three and those are, .NET Core, .NET Framework and Xamarin.
The .NET Framework supports Windows and Web applications.
.NET Core is the new open-source and cross-platform framework to build applications for all operating system including Windows, Mac, and Linux.
When you want to build mobile (iOS, Android, and Windows Mobile) apps using C#, Xamarin is your only choice.
You cannot use System.Windows.Forms inside a Xamarin Project and it is incompatible.

Can PCLs created in Visual Studio be used in Xamarin projects?

I created a Portable Class Library the other day in VS2013. It targeted the following platforms:
.NET Framework 4.5
Windows 8.1
Windows Phone 8.1 (non-Silverlight)
My question is, can this be used in Xamarin projects such as Xamarin.iOS or Xamarin.Android? I've found a project claiming to support Xamarin, but grepping the solution and project files for "ios" and "android" turn up nothing. If not, what can I do to make my library portable to those platforms?
Thanks.
You need to install Xamarin for Visual Studio first if you haven't already
Open your PCL project and change the target profile to include the Xamarin platforms you want to support. (e.g. Profile 78)
Optionally retarget all your dependencies (projects/nugets)
Recompile your PCLs
You should now have dlls that work also in Xamarin.
You'll have to make your project target those platforms and then recompile your .dlls in order to make them available for Android and iOS.
I don't know what is the edition of your Visual Studio, but the options to target Android/iOS should be available in VS2013. In any case, try downloading Visual Studio 2015 community (which is free), open your project using it and the option should be there.
If none of this works, you can also try manually changing your .csproj file to a different profile. This is stated to have worked on this answer.

Do universal windows assemblies work with a .net console app?

I am working on a Universal Windows assembly and cannot add a reference to it from a C# console application project in the same solution. The console app would be a simple test bed application for interactive use of the universal dll.
Do universal windows assemblies not work with straightup Console apps? When I try to add a reference to the universal project VS.NET shows a very uninformative "Cannot add reference to project" message.
They don't. But if you want to share assemblies between different platforms you should move the logic to a new assembly and setup this one as PCL (portable class library) setting the platforms you want to support.
That's because Universal windows Apps doesn't share the same "binary" formats with classic .Net Framework Applications. They don't even share the same CLR.

How do I recompile an assembly targeting the MonoTouch profile?

On http://docs.xamarin.com/ios/about/assemblies it says that if I want to provide my code as an assembly to other MonoTouch developers: "You must recompile your source code to generate assemblies targeting the MonoTouch profile".
How do I do that?
How do I do that with Visual Studio?
How do I do that with msbuild?
I found MonoDevAssist at http://monodevassist.codeplex.com/documentation, but the instruction there said I should copy a bunch of DLLs from "your Mac". I don't have a Mac. I have installed MonoTouch for Android on my Windows machine, but I can't find a directory like the one in that description.
I have installed MonoTouch for Android on my Windows machine
What you likely have is Mono for Android which runs fine on Windows and targets Android.
MonoTouch is another product from Xamarin, targeting iOS (iPhones, iPod, iPads) and it requires a Mac computer.
Even if there's quite a bit of features shared between the two products, in general, you need to look at the documentation for the product you have.
How do I do that?
Simply re-compile your existing source code including reference(s) to the assemblies that are shipped with Mono for Android.
How do I do that with Visual Studio?
Create a new project, e.g. a library, for Mono for Android. Add your source code to the project. Add references to the SDK assemblies you requires. Rebuild your code.

How to add external non windows phone class library project reference to a windows phone project?

Hi there I am new to the windows phone development and I am trying to build a data driven application in which I have Created my BLL and EL and DAL ,which are all of windows phone class library type project.
I have also an extra project of type class library in my solution in which I have added the Reference to "MyGeneration.dOOdads.dll" file .
Now I want this project to be referenced in the windows phone app project.But when I try to add a reference ,The VS 2010 says...."Unable to add the selected project refernce.The project reference must be another silver light for windows phone project that is the same or the lower version ".
.
.
.
Kindly help me in this scenario. Thanks
That can't and won't work. The phone runtime only has access to a timy subset (well, sort-of) of the full .NET libraries, so any non-phone-7 library is extremely unlikely to operate at all. To stop this surprising people, only libraries built against that runtime are allowed to be referenced.
If possible, create a new project with the same c# files, targeting the phone 7 framework. Now reference this project. It is quite likely that some bits will fail to compile (demonstrating the fact that it also wouldn't have run), which can be rectified in a number if ways (#if blocks, alternative .cs files, etc).
You might also have some luck by making the existing project a "portable class library" - this, however, is the most restrictive subset of all the common frameworks, and is even less likely to still compile (without changes).
Using the Portable Class Library project, you can build portable assemblies that work without modification on the .NET Framework, Silverlight, Windows Phone 7, or Xbox 360 platforms.
(from MSDN)

Categories

Resources