The project will now build on both macOS and Windows, but CodeQL will
only run during the Windows job.
This fixes a build failure that would occur on macOS when CodeQL was
enabled.
We mistakenly broke this project in commit ab48982d, as an SDK style
fsharp project will not auto glob .fs files when compling.
Fix the project by compiling `ResourceTypeProvider.fs` again, however
this will only work for Classic Xamarin.Android projects.
There are [non-trivial issues][0] that prevent `ResourceTypeProvider.fs`
from running on .NET Core (CodeDom compiling, AppDomain usage, etc).
These are not worth fixing at this time, as an alternate solution has
been provided in https://github.com/fabulousfx/FSharp.Android.Resource.
[0]: https://github.com/xamarin/Xamarin.Android.FSharp.ResourceProvider/issues/11#issuecomment-1028793264
We'll want to release a new version of this package to nuget.org in the
near future, as the latest stable version does not work with the .NET 6
Android SDK. We'll want to enable package signing to release an updated
version.
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.
...to be embedded into the F# assembly - not mirrored types
Re https://github.com/xamarin/xamarin-android/issues/1513
and https://github.com/mono/monodevelop/issues/4456
Bump to 1.0.0.22
We also need code such as the following adding to the NUnit template and
possibly others.
```fs
namespace fsandroidnunit
// the name of the type here needs to match the name inside the ResourceDesigner attribute
type Resources = fsandroidnunit.Resource
[<assembly: Android.Runtime.ResourceDesigner("fsandroidnunit.Resources", IsApplication=true)>]
()
```