Migrate the Win8.1/WP8.1 application to the Universal Windows Platform, win8.1wp8.1
In the previous article on opening the project created in CTP in VS2015 RC, we introduced how to open the Universal project created in CTP in RC, in this article, we will explain how to migrate Windows 8.1/WP8.1 applications to the Universal Windows Platform.
In 2015RC, We can migrate 8.1 of the applications to the unified platform, and then use the new API for development. Next we will use the wp8.1 application as an example to explain the next step.
1. Use 2015 to open the previous project.
2. Right-click the project and select "Uninstall project ".
3. Right-click the project and select "Edit XXX. csproj"
4. As in the previous article, obtain the platform version number with the path"\ Program Files (x86) \ Windows Kits \ 10 \ Platforms \ UAP"
AddEnableDotNetNativeCompatibleProfileNode, value:True
6. replace all vs versions from 12.0 to 14.0. In this step, replace them directly (CTRL + H)
7. Delete the configurationAnyCPUPropertyGroup node
8. Check that the remaining configuration is the Release PropertyGroup node. If noUseDotNetNativeToolchainAdd a sub-node. The value must beTrueThat is, <UseDotNetNativeToolchain> true </UseDotNetNativeToolchain>
9. If it is a mobile phone project, you also need to delete the following Node
10. Now reload our project and we will find that the project type has changed to Windows Universal! You need to modify manifest.
11. Open the manifest file. First we need to replace all the schemas and replace the Package node with the following section.
<Package xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10" xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10" xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest" IgnorableNamespaces= "uap mp">
For Win8.1 applications, you also need to add an mp: PhoneIdentity node, as shown below. PhoneProductId is the Name of Identity, and PhonePushedId is a fixed value.
<Identity Name="fe8a6971-8349-489b-8941-83dd308e9b9b" Publisher="CN=xxxxxxx" Version="1.0.0.0" /> <mp:PhoneIdentity PhoneProductId="fe8a6971-8349-489b-8941-83dd308e9b9b" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>
12. Add the following sub-nodes under the Package. The version number is what we have been using
<Dependencies><TargetDeviceFamily Name="Windows.Universal" MinVersion="10.0.10069.0" MaxVersionTested="10.0.10069.0" /></Dependencies>
13. DeletePrerequisitesNode
14. Check your Resources node.ScaleAndDXFeatureLevelAddUapThe namespace is as follows:
<Resources> <Resource Language="x-generate"/> <Resource uap:Scale="180"/> <Resource uap:DXFeatureLevel="dx11"/> </Resources>
15. Check your Capability node. If you declare the following permissions, you need to add the uap namespace.
- DocumentsLibrary
- PicturesLibrary
- VideosLibrary
- MusicLibrary
- EnterpriseAuthentication
- SharedUserCertificates
- RemovableStorage
- Appointments
- Contacts
For example:
<Capabilities> <uap:Capability Name="documentsLibrary"/> <uap:Capability Name="removableStorage"/></Capabilities>
16. Change the namespace of the VirsualElements node and Its subnodes to uap.
<uap:VisualElements DisplayName="App9" Square150x150Logo="Assets\Logo.png" Square44x44Logo="Assets\SmallLogo.png" Description="App9" BackgroundColor="transparent"> <uap:DefaultTile Wide310x150Logo="Assets\WideLogo.png" Square71x71Logo="Assets\Square71x71Logo.png"/> <uap:SplashScreen Image="Assets\SplashScreen.png"/></uap:VisualElements>
For the Win8.1 application, note that the SIZE in the Square {size} Logo attribute has changed. The SIZE of the 70-attribute has changed to 71x71, and the 30-x30 attribute has changed to 44x44.
Old:
<m2:VisualElements … Square30x30Logo="Assets\SmallLogo.png" …> <m2:DefaultTile … Square70x70Logo="images/70x70.png"></m2:VisualElements>
New:
<uap:VisualElements … Square44x44Logo="Assets\SmallLogo.png" …> <uap:DefaultTile … Square71x71Logo="images/70x70.png"></uap:VisualElements>
17. Check the Extensions node and add the namespace uap for the following nodes.
- Windows. accountPictureProvide
- Windows. alarm
- Windows. appointmentsProvider
- Windows. autoPlayContent
- Windows. autoPlayDevice
- Windows. cachedFileUpdate
- Windows. cameraSettings
- Windows. fileOpenPicker
- Windows. fileTypeAssociation
- Windows. fileSavePicke
- Windows. lockScreenCall
- Windows. printTaskSettings
- Windows. protocol
- Windows. search
- Windows. shareTarget
For example:
<Extensions> <uap:Extension Category="windows.alarm"/> <uap:Extension Category="windows.search" EntryPoint="MyActivateableClassId.baz"/> <uap:Extension Category="windows.protocol"> <uap:Protocol Name="mailto" DesiredView="useHalf"> <uap:DisplayName>MailTo Protocol</uap:DisplayName> </uap:Protocol> </uap:Extension></Extensions>
18. The type isChatMessageNotificationAdd the uap namespace to the background task
For example:
<Extension Category="windows.backgroundTasks" EntryPoint="Fabrikam.BackgroundTask" Executable="MyBackground.exe"> <BackgroundTasks ServerName="MyBackgroundTasks"> <uap:Task Type="chatMessageNotification"/> </BackgroundTasks></Extension>
19. Modify PackageDependency and add Publisher and MinVersion attributes.
<Dependencies> <PackageDependency Name="Microsoft.VCLibs.120.00" Publisher="CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US" MinVersion="12.0.30113.0" /></Dependencies>
20. Replace background tasks of Type gattCharacteristicNotification and rfcommConnection with Bluetooth.
<Extension Category="windows.backgroundTasks" EntryPoint="Fabrikam.BackgroundTask" Executable="MyBackground.exe"><BackgroundTasks ServerName="MyBackgroundTasks"> <Task Type="bluetooth"/></BackgroundTasks></Extension>
21. Replace bluetooth. rfcomm and bluetooth. genericAttributeProfile with the new bluetooth capability
Old:
<Capabilities> <m2:DeviceCapability Name="bluetooth.rfcomm"> <m2:Device Id="any"> <m2:Function Type="serviceId:34B1CF4D-1069-4AD6-89B6-E161D79BE4D8"/> </m2:Device> </m2:DeviceCapability> <m2:DeviceCapability Name="bluetooth.genericAttributeProfile"> <m2:Device Id="any"> <m2:Function Type="name:heartRate"/> </m2:Device> </m2:DeviceCapability></Capabilities>
New:
<Capabilities> <uap:DeviceCapability Name="bluetooth"/></Capabilities>
22. Delete Windows. contact and windows. contactPicker extensions
23. Delete the ForgroundText and ToastCapable attributes of VisualElements.
24. Delete the DefaultSize attribute of DefaultTitle
25. Delete the ApplicationView Node
26. The manifest file has been modified. Save it! Although it seems that there are a lot of steps, in fact, many steps after the 17th may not be used
27. We need to delete some additional files below
- Check the subdirectory "\. vs \ {project name} \ v14" in the solution directory. If the ". suo" file exists, delete it.
Now our project has been successfully migrated to the Universal Windows Platform, but for many applications, we still need to modify the code, because many Windows 10 APIs have changed.