4
votes

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?

1

1 Answers

7
votes

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.