Xamarin.Android.FSharp.Reso.../Xamarin.Android.FSharp.Reso...

14 строки
534 B
XML
Исходник Обычный вид История

[build] support for .NET 5.0+ (#6) Trying to build an F# project under .NET 5 fails with: error FS3053 : The type provider 'Xamarin.Android.FSharp.ResourceProvider' reported an error : The type provider constructor has thrown an exception: Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. We need this library to target `netstandard2.0`, so it will work on .NET framework, Mono, and .NET Core (.NET 5+). I reworked `Xamarin.Android.FSharp.ResourceProvider.fsproj` to be `netstandard2.0`. This created a new issue when I tried to *use* the package in a .NET 5 project: Foo.Android.fsproj : error NU1202: Package Xamarin.Android.FSharp.ResourceProvider 1.0.0.29 is not compatible with net5.0 (net5.0). Package Xamarin.Android.FSharp.ResourceProvider 1.0.0.29 supports: Foo.Android.fsproj : error NU1202: - monoandroid81 (MonoAndroid,Version=v8.1) Foo.Android.fsproj : error NU1202: - netstandard2.0 (.NETStandard,Version=v2.0) .NET 5.0 seems to prefer `netstandard2.0` over `monoandroid81`, and so it doesn't know what to do here: hence the error. I literally, could run this command on the package and it works afterward: zip -d Xamarin.Android.FSharp.ResourceProvider.1.0.0.29.nupkg lib/netstandard2.0/Xamarin.Android.Fsharp.ResourceProvider.dll The fix is to use the `.nuspec` instead of the `.fsproj`: -nuget pack Xamarin.Android.FSharp.ResourceProvider.fsproj +nuget pack Xamarin.Android.FSharp.ResourceProvider.nuspec I also made some changes to the Xamarin.Android project (just general cleanup): * Migrate from `packages.config` to `@(PackageReference)` * We can rely on `/restore` now in the build definition. `restoreNugetPackages` is deprecated, so we shouldn't use it. * Removed an `<Import/>` that was unused.
2020-08-21 18:53:09 +03:00
<Project Sdk="Microsoft.NET.Sdk">
2017-10-24 17:01:11 +03:00
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
2017-10-24 17:01:11 +03:00
<RootNamespace>Xamarin.Android.FSharp</RootNamespace>
[build] support for .NET 5.0+ (#6) Trying to build an F# project under .NET 5 fails with: error FS3053 : The type provider 'Xamarin.Android.FSharp.ResourceProvider' reported an error : The type provider constructor has thrown an exception: Could not load file or assembly 'System.CodeDom, Version=0.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. We need this library to target `netstandard2.0`, so it will work on .NET framework, Mono, and .NET Core (.NET 5+). I reworked `Xamarin.Android.FSharp.ResourceProvider.fsproj` to be `netstandard2.0`. This created a new issue when I tried to *use* the package in a .NET 5 project: Foo.Android.fsproj : error NU1202: Package Xamarin.Android.FSharp.ResourceProvider 1.0.0.29 is not compatible with net5.0 (net5.0). Package Xamarin.Android.FSharp.ResourceProvider 1.0.0.29 supports: Foo.Android.fsproj : error NU1202: - monoandroid81 (MonoAndroid,Version=v8.1) Foo.Android.fsproj : error NU1202: - netstandard2.0 (.NETStandard,Version=v2.0) .NET 5.0 seems to prefer `netstandard2.0` over `monoandroid81`, and so it doesn't know what to do here: hence the error. I literally, could run this command on the package and it works afterward: zip -d Xamarin.Android.FSharp.ResourceProvider.1.0.0.29.nupkg lib/netstandard2.0/Xamarin.Android.Fsharp.ResourceProvider.dll The fix is to use the `.nuspec` instead of the `.fsproj`: -nuget pack Xamarin.Android.FSharp.ResourceProvider.fsproj +nuget pack Xamarin.Android.FSharp.ResourceProvider.nuspec I also made some changes to the Xamarin.Android project (just general cleanup): * Migrate from `packages.config` to `@(PackageReference)` * We can rely on `/restore` now in the build definition. `restoreNugetPackages` is deprecated, so we shouldn't use it. * Removed an `<Import/>` that was unused.
2020-08-21 18:53:09 +03:00
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
2017-10-24 17:01:11 +03:00
<OutputPath>bin</OutputPath>
</PropertyGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="ResourceTypeProvider.fs" />
2017-10-24 17:01:11 +03:00
<EmbeddedResource Include="Resource.designer.cs" />
</ItemGroup>
</Project>