I’m having some trouble reading an embedded resource (text file) in windows-8, usually I use Assembly.GetExecutingAssembly() but I can’t seem to do it in this one. I’m referencing the System.Reflection namespace but it says cannot find, thinking it was possibly removed.
Any ideas?
Currently using Windows 8 Consumer Preview
Code:
Assembly readAssembly = Assembly.GetExecutingAssembly();
StreamReader streamReader = new StreamReader(readAssembly.GetManifestResourceStream("Test.txt"));
Error:
System.Reflection.Assembly’ does not contain a definition for ‘GetExecutingAssembly’
In WinRT the resources should be included in the package. You use
Package.Current.InstalledLocation.GetFileAsyncto read the resource.The following post has some sample code:
http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/d4b327e3-a8f2-4d3c-8ed7-ba2ea953d0b9