Windows phone 8 我可以在Windows 8.1通用应用程序和Windows 10通用Windows应用程序之间共享代码吗

Windows phone 8 我可以在Windows 8.1通用应用程序和Windows 10通用Windows应用程序之间共享代码吗,windows-phone-8,windows-8.1,win-universal-app,windows-10,Windows Phone 8,Windows 8.1,Win Universal App,Windows 10,我有一个针对Windows 8.1和Windows Phone 8.1的现有通用应用程序 我现在想创建该应用程序的Windows 10版本。但我仍然想维护现有的Windows8.1和WindowsPhone应用程序 我可以在(旧的)universal 8.1应用程序和Windows universal应用程序之间共享代码吗 我想象这样的项目结构: 目前我有: App.Windows App.WindowsPhone 应用程序共享 我想为Windows 10添加另一个项目: App.Wind

我有一个针对Windows 8.1和Windows Phone 8.1的现有通用应用程序

我现在想创建该应用程序的Windows 10版本。但我仍然想维护现有的Windows8.1和WindowsPhone应用程序

我可以在(旧的)universal 8.1应用程序和Windows universal应用程序之间共享代码吗

我想象这样的项目结构:

目前我有:

  • App.Windows
  • App.WindowsPhone
  • 应用程序共享
我想为Windows 10添加另一个项目:

  • App.Windows10
引用现有的共享项目


这是可行的办法吗?或者,有什么更好的方法

是的,你能做到。将通用Windows项目添加到现有解决方案中,选择添加引用。。。从“项目”菜单或通过右键单击解决方案资源管理器中项目的“引用”文件夹,然后从“引用管理器”的“共享项目”部分添加App.Shared

您需要确保共享文件在两种上下文中都有效,或者使用条件编译来区分差异