For years we've shared our C# code among these platforms by creating projects for each platform inside a directory containing all the source code for that project. As we added new platforms, if a code file containing wouldn't compile on the new platform we would create a copy of the code file and modify it so that it would work on it's intended platform.
A project directory might look like this
Application.Base
Applications.Base.CF.csproj
Applications.Base.WPF.csproj
Applications.Base.Phone81.csproj
Properties
AssemblyInfo.cs
Src
WidgetWPF.cs
WidgetPhone81.cs
Widget.cs
Now I'm taking the same approach for UWP and I'm running into this issue. When adding a new project for UWP:
Application.Base
....
Applications.Base.UWP
Properties
AssemblyInfo.cs
DSI.Applications.Base.UWP.rd.xml
...
Now when I go to my WPF solution, I get an error compiling the Applications.Base.WPF project (event though no UWP project files are included in the WPF project):
Your project is not referencing the ".NETFramework,Version=v4.6.1" framework. Add a reference to ".NETFramework,Version=v4.6.1" in the "frameworks" section of your project.json, and then re-run NuGet restore. DSI.Applications.Base
After some A/B testing, I find that I can fix the error by using nuget to remove the UWP's reference to Microsoft.NETCore.UniversalWindowsPlatform. Of course that breaks the UWP project. There is no project.json present at all.
Is there a workaround that will allow us to continue code sharing in this manner? Refactoring our shared projects to accommodate all platforms would be a huge burden - there are many shared projects like this - some of which are shared to even additional platforms (our ASP.Net project.)