Xamarin Forms iOS app can't be deployed with too many BundleResource files

Dan ny 21 Reputation points
2022-01-31T01:12:22.043+00:00

I have a Xamarin Forms app with 13,000 small audio files, totaling about 50MB. If I don't include them in the .csproj file, then the app builds and deploys fine. However, as soon as I include them:

<ItemGroup>
<BundleResource Include="Assets\Audio\*.mp3" />
  </ItemGroup>

then the deploy fails with the following error

Xamarin.VisualStudio.IOS.IdbClient Error: 0 : Deploy failed. The app 'myApp' could not be deployed to the device 'My iPod touch'. Error: The post for client vs23920 on topic xvs/idb/deploy-app has been cancelled. Please check the logs for more details.
System.OperationCanceledException: The operation was canceled.
   at System.Threading.CancellationToken.ThrowOperationCanceledException()
   at System.Threading.SemaphoreSlim.<WaitUntilCountOrTimeoutAsync>d__31.MoveNext() 
   ...

Is there any way to get this working? The max bundle size in iOS is 4GB, so it seems odd that Xamarin would fail after only 50MB..

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,297 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Cole Xia (Shanghai Wicresoft Co,.Ltd.) 6,751 Reputation points
    2022-01-31T05:17:43.863+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    Did you add <ItemGroup> in .csproj file manually ?

    If so, please remove it from there, and re-add the files to project , it will automatically create the code which includes the files in .csproj.

    The above operation could make sure that

    1. Generate the real file location.
    2. Add the files one by one correctly .(I made a test that add 100 files to project , it shows 100 <ItemGroup> not a single one with *.mp3 ) .

    Best Regards,

    Cole Xia


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.