radimitrov / CSharpShellApp

77 stars 18 forks source link

MAUI Raw Asset not included in output #372

Closed Jooe20 closed 2 months ago

Jooe20 commented 3 months ago

&ItemGroup& & MauiAsset Include="Resources\Raw**" LogicalName="%(RecursiveDir)%(Filename)%(Extension)" /& & /ItemGroup&

NOTE: I replaced < with & bcos xml comment is not visible.

I used the above build action in .csproj to include a large file (50 MB) as a raw asset but the file is not included in the exported apk. Am I doing something wrong? Do I have to include the name of the file ( Data.db) despite the fact that it is in "Resources\Raw\" folder which I have tried already without success? Thanks a lot I am new to MAUI.

radimitrov commented 3 months ago

That folder should be included by default in APK assets. Does it only skip large files?

Jooe20 commented 3 months ago

I only tried one file but I will try a small file and come back to comment.

Jooe20 commented 3 months ago

Small files are also not included. I used MAUI AboutAssets.txt and tried to open it like this :

async Task >string< LoadMauiAsset() { using var stream = await FileSystem.OpenAppPackageFileAsync("AboutAssets.txt"); using var reader = new StreamReader(stream); var contents = reader.ReadToEnd(); return contents ; }

but I got FileNotFound exception. I even copied
" AboutAssets.txt" manually into the asset folder created by CSharpShell but the error still persists.

radimitrov commented 3 months ago

Seems to to an issue with MAUI projects. I will see about fixing it it soon

Jooe20 commented 3 months ago

Alright. Thanks.