Xamarin.Forms Resolving System.Reflection.TargetException
Setting an image in your Xamarin.Forms project is easily done when setting the image as embedded resource since instead of having a copy of the image in each application’s file structure the image file is embedded in the assembly as a resource. According to this documentation, it is done easily as follows:
1 | var embeddedImage = new Image { Source = ImageSource.FromResource("ImagesProj.beach.jpg") }; |
I succeeded in adding images into my Xamarin.Forms projects using this method a while ago on earlier versions of Xamarin.Forms. But recently, I got an issue when trying this again on Xamarin.Forms 2.5.0.280555 and .Net standard 2.0 as my shared project. This issue was System.Reflection.TargetException. This was a pain in the ?. But, it wasn’t that difficult to resolve.
Don’t miss any post and subscribe to the mailing list
[…]