Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I share code between a Windows 8.1 Universal app and a Windows 10 Universal Windows App

I have an existing universal app targeting Windows 8.1 and Windows Phone 8.1.

I now want to create a Windows 10 version of the app. But I still want to maintain the existing Windows 8.1 and Windows Phone apps.

Can I share code between the (old) universal 8.1 app and the Windows Universal App?

I imagine a project structure like this:

Currently I have:

  • App.Windows
  • App.WindowsPhone
  • App.Shared

I would like to add another project for Windows 10:

  • App.Windows10

With a reference to the existing Shared project.

Is that a feasible approach? Or what would be a better approach?

like image 628
stefan.s Avatar asked Mar 15 '23 02:03

stefan.s


1 Answers

Yes, you can do that. Add the Universal Windows project to your existing solution, select Add References... from either the Project menu or by right clicking on the Project's References folder in the Solution Explorer, then add App.Shared from the Reference Manager's Shared Projects section.

You'll need to make sure that the shared files are all valid in both contexts or use conditional compilation to separate out the differences.

like image 173
Rob Caplan - MSFT Avatar answered Mar 29 '23 23:03

Rob Caplan - MSFT