I am making a plugin for Xamarin which is a .NET Standard 2.0 project which targets multi platforms. I added image and audio resources, and included them targeting monoandroid. Then, in a Xamarin Forms sample app, I referenced the Android project to my net standard project and the resources are successfully deployed.
I am now trying to include these resources targeting Xamarin.iOS platform but they are not deployed in the iOS Project of the Sample App platform after compiling.
I tried to add the resources as BundleResource, Embedded Resource, and Content inside the net standard .csproj, but none of them worked.
This is an example of the code i tried:
<ItemGroup Condition=" $(TargetFramework.StartsWith('Xamarin.iOS')) "> <Reference Include="System" /> <Reference Include="System.Xml" /> <Reference Include="System.Core" /> <Reference Include="Xamarin.iOS" /> <PackageReference Include="Newtonsoft.Json" Version="11.0.1" /> <PackageReference Include="Xam.Plugin.DeviceInfo" Version="3.1.0" /> <PackageReference Include="Xamarin.Firebase.iOS.Core" Version="5.2.0" /> <PackageReference Include="Xamarin.Firebase.iOS.MLKit" Version="0.13.0.1" /> <PackageReference Include="Xamarin.Firebase.iOS.MLKit.Common" Version="0.13.0" /> <BundleResource Include="Resources\MyAudio.m4a" /> -> THIS LINE HERE IS THE IMPORTANT <Compile Include="Platforms\iOS\**\*.cs" /> </ItemGroup>
If I add MyAudio.m4a in the iOS project of the Sample App it works well, But i would prefer to include this resource in my net standard plugin.
Is there any solution?