MSBuildSdkExtras
MSBuildSdkExtras copied to clipboard
How to multi-target UWP and Xamarin in F# project?
I try to multi-target https://github.com/xperiandri/Elmish.Uno project to UWP and Xamarin.
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;xamarinios10;monoandroid90;uap10.0</TargetFrameworks>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<!--https://github.com/dotnet/fsharp/issues/7363#issuecomment-519270901-->
<Deterministic>false</Deterministic>
<!--<DebugType>portable</DebugType>-->
</PropertyGroup>
<ItemGroup>
<Compile Include="Utils.fs" />
<Compile Include="Types.fs" />
<Compile Include="Config.fs" />
<Compile Include="Binding.fs" />
<Compile Include="ViewModel.fs" />
<Compile Include="ViewModelUtilities.fs" />
<Compile Include="Program.fs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Elmish" Version="3.0.6" />
<PackageReference Include="Uno.Core" Version="1.29.0" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='xamarinios10' or '$(TargetFramework)'=='monoandroid80' or '$(TargetFramework)'=='monoandroid90' or '$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="Uno.UI" Version="2.2.0-dev.171" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetFramework)' == 'uap10.0' ">
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform " Version="6.2.9" />
</ItemGroup>
</Project>
For Xamarin I get:
error NETSDK1005: Assets file 'C:\Users\Andrii\Dev\Frebo\Biblioteko\Elmish.Uno\src\Elmish.WPF\obj\project.assets.json' doesn't have a target for 'Xamarin.iOS,Version=v1.0'. Ensure that restore has run and that you have included 'xamarinios10' in the TargetFrameworks for your project.
error NETSDK1005: Assets file 'C:\Users\Andrii\Dev\Frebo\Biblioteko\Elmish.Uno\src\Elmish.WPF\obj\project.assets.json' doesn't have a target for 'MonoAndroid,Version=v9.0'. Ensure that restore has run and that you have included 'monoandroid90' in the TargetFrameworks for your project.
For UWP:
error NU1202: Package FSharp.Core 4.7.0 is not compatible with uap10.0 (UAP,Version=v10.0). Package FSharp.Core 4.7.0 supports:
error NU1202: - net45 (.NETFramework,Version=v4.5)
error NU1202: - netstandard2.0 (.NETStandard,Version=v2.0)
error NU1202: Package Elmish 3.0.6 is not compatible with uap10.0 (UAP,Version=v10.0). Package Elmish 3.0.6 supports:
error NU1202: - net461 (.NETFramework,Version=v4.6.1)
error NU1202: - netstandard1.6 (.NETStandard,Version=v1.6)
error NU1202: - netstandard2.0 (.NETStandard,Version=v2.0)
Do you know how that can be fixed?