It seems like every chance they get, Microsoft reminds developers that converting to the Universal Windows Platform is the best choice for most apps. They have gone out of their way to make step-by-step instruction guides to ease new apps onto the UWP and today’s blog from the Windows App Team is no different.
The Windows Dev Center has issued a porting guide, with significant detail, to help you manually migrate Windows Phone Silverlight apps over to UWP. However, the Silverlight to Windows 10 bridge can help you circumvent up to 80% of the work by converting the code automatically.
Step One: Download the Bridge
Step Two: Run the Tool
Running the Windows Phone Silverlight-to-UWP conversion tool will take care converting your app’s manifest files to the new format. The only input needed to run the tool is the path of the project file you want to convert to UWP and the directory of where you want the newly created UWP files to be saved.
Step Three: Troubleshooting the missing DLLs
The most common cause of missing DLLs is the result of third party libraries being used in the Silverlight app. If the codes reference to DLLs that haven’t been migrated to UWP, it will cause unrecognized namespaces to crop up in your conversion. The best way to fix the missing DLL issues is to manually replace them with similar standard controls.
Step Four: Troubleshooting unconverted Silverlight code
While the bridge tool for Silverlight to UWP has approximately 2,300 mappings for API and XAMLs, sometimes it’s still not enough to cover every case of Silverlight’s coding. When it comes to these hiccups between the conversion process, you can consult the namespace and class mappings resource that will help identify code that doesn’t have a UWP counterpart. If not, then you can decide whether you want to alter the unconverted code to use a different UWP class or create a helper class to wrap the unconverted class code.
Step Five: Troubleshooting controls and events
Your app is almost converted, but some mappings are not working as they should in the Universal Windows Platform. The controls behaving different could be adjusted by defining a field for the control and assigning it the control’s Loaded event. Using an MVVM approach by binding to decouple controls is also an option.
Since the Silverlight Bridge to Window tool is still in developer preview, it’s not ready to handle all of the conversions and requires some finesse. Even so, it is significantly more efficient than porting apps manually. Converting your Windows Phone Silverlight app to the Universal Windows Platform will not only enable you to have a longer reach, but doing so will also bring a new audience to your product. With the UWP, apps are able to be accessed across many more devices to ultimately enhance your developing experience.Further reading: Developers, Microsoft, Silverlight, Universal Windows App, Universal Windows Platform, Windows 10, Windows 10 Mobile