How to include/deploy Audio and Image resources in a .NET Standard plugin targeting iOS proj RRS feed

  • Question

  • User372458 posted

    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="" /> <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?

    Tuesday, September 3, 2019 3:05 PM

All replies

  • User392666 posted

    You can visit this https://github.com/jsuarezruiz/awesome-xamarin-forms site to see if this can solve your problem.

    For more information on mobile app development you can visit ArStudioz

    Tuesday, February 11, 2020 6:07 AM