【发布时间】:2018-11-15 19:37:15
【问题描述】:
我正在开发一个 Xamarin Forms 应用程序,它有两个项目,一个 Android 应用程序和一个 iOS 应用程序。所有其他代码都存储在共享项目中。
解决方案如下:
- MyApp.Android(Android 项目),引用 MyApp.Base
- MyApp.iOS(iOS 项目),引用 MyApp.Base
- MyApp.Base(共享项目)
我正在使用以下代码从共享项目中读取 SVG 图像:
using (var stream = GetType().Assembly.GetManifestResourceStream("MyApp.Base.image.svg"))
{
// do work here...
}
当图像在 Android 或 iOS 项目中时,这非常有效,但我希望共享图像,所以我将它放在共享项目中。
GetType().Assembly 返回 MyApp.Android,因此找不到图像。我想我忽略了一些东西,但我无法找到解决方案。
谁能指出我正确的方向?谢谢!
【问题讨论】:
标签: c# svg xamarin.forms