问题
I am working on a Xamarin forms project to use OpenGL/OpenTK. I am trying to load a shader using GetManifestResourceStream. Whatever I do I get null
code is being run from .Shared project, shaders are in .ios / .Android resources directory
string prefix;
#if __IOS__
prefix = "OpenGLTesting.iOS.";
#endif
#if __ANDROID__
prefix = "OpenGLTesting.Droid.";
#endif
var assembly = typeof(App).GetTypeInfo ().Assembly;
Stream stream = assembly.GetManifestResourceStream (prefix + shaderName + ".glsl");
回答1:
Add some debugging code, like calling assembly.GetManifestResourceNames ();
so make sure you have both the right name and that it was embedded in your assembly.
来源:https://stackoverflow.com/questions/30917144/xamarin-loading-resources-via-getmanifestresourcestream