Yes, porting is possible. I would suggest creating a new project in this solution (most of the solutions of this git already added UWP support, as I saw) and redid most of the things. In some projects using platform-specific code, this port may not work, as some APIs have changed from WP8 to UWP - as you probably know.
After this procedure, I still had problems - I did not have a working .appxmanifest file, so I can not create a .pfx file. This warns you that the certifcate file is missing.
I'm not sure if all the steps are needed. I leave it as homework;)
In any case, here I will show you the steps to transfer the TodoREST project to UWP:
- Unloading an iOS and Droid project will simplify
- Remove all nuget packages from Portable and WinPhone81
- Change the portable class profile to Profile111 (uncheck WP8 Silverlight as the target)
- Now you can reinstall Xamarin.Forms and Newtonsoft.Json on the portable project (deletion was necessary to change the profile - which was necessary because there were some errors).
- Remove app.config from WinPhone81 project
Add the project.json file to the WinPhone81 project and add the following content:
{ "dependencies": { "Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0", "Xamarin.Forms": "2.0.0.6482" }, "frameworks": { "uap10.0": { } }, "runtimes": { "win10-arm": { }, "win10-arm-aot": { }, "win10-x86": { }, "win10-x86-aot": { }, "win10-x64": { }, "win10-x64-aot": { } } }
Save all and close the WinPhone81 project
In the file explorer go to the folder and edit Package.appxmanifest
Exchange Package Tag:
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" xmlns:m3="http://schemas.microsoft.com/appx/manifest/uap/windows10" IgnorableNamespaces="m3 mp">
Delete ... and add the following instead:
<Dependencies> <TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.0.0" MaxVersionTested="10.0.0.0"/> </Dependencies>
Edit TodoREST.WinPhone81.csproj:
First, <PropertyGroup> replace <TargetPlatformVersion> as follows:
<TargetPlatformIdentifier>UAP</TargetPlatformIdentifier> <TargetPlatformVersion>10.0.10586.0</TargetPlatformVersion> <TargetPlatformMinVersion>10.0.10586.0</TargetPlatformMinVersion>
Change ProjectTypeGuids to
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
On each PropertyGroup with Condition=... replace WINDOWS_PHONE_APP with DefineConstants with WINDOWS_UAP
- Save
- Update project in Visual Studio
- Change MainPage.xaml and change
<forms:WindowsPhonePage to <forms:WindowsPage and change the namespace to using:Xamarin.Forms.Platform.UWP (from .WinRT ) - Here I had to restart VS2015 for some reason, as it did not notice project.json
- Run the project and debug!
Hope this answers your questions.
Matt
source share