我按照这些说明如何在xamarin表单共享项目中组织资源:
我在xamarin.forms共享项目中使用子文件夹组织图像,例如" Assets.graphics.image.png"和" Assets.tiles.image.png"。在我的Android和UWP中使用" foreach(在assembly.GetManifestResourceNames()中的var res)"报告所有资源时保留文件夹路径,例如" namespace.Droid.Assets.graphics.image.png"。在iOS中,它们显示为" namespace.iOS.image.png"由于某种原因丢失所有文件夹路径。有关为什么会发生这种情况的任何建议吗?这是一个错误,或者iOS的某个地方有一个不起眼的设置允许在共享项目资源中使用文件夹和子文件夹吗?
我的解决方案结构如下所示:
Namespace (shared project stuff)
>Assets (folder)
>>data (sub-folder under Assets folder)
>>graphics (sub-folder under Assets folder)
>>tiles (sub-folder under Assets folder)
>>modules (sub-folder under Assets folder)
>>sounds (sub-folder under Assets folder)
>>ui (sub-folder under Assets folder)
>lots of classes
Namespace.Android
>lots of files under here but not the image resources which are in graphics and tiles folders above in shared project
Namespace.iOS
>lots of files under here but not the image resources which are in graphics and tiles folders above in shared project
Namespace.UWP
>lots of files under here but not the image resources which are in graphics and tiles folders above in shared project