Results 1 to 2 of 2

Thread: why I still receiving Null when calling GetManifestResourceStream?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2003
    Posts
    782

    why I still receiving Null when calling GetManifestResourceStream?

    Hi,

    I have files in the Resources folder and I have set the Build Action to Embedded Resource, why I still receiving Null when calling GetManifestResourceStream?

    Code:
    var assembly = Assembly.GetEntryAssembly();
     var resourceStream = assembly.GetManifestResourceStream(Assembly.GetCallingAssembly().GetName().Name + ".Resources.MyTest.html");
    
    if (resourceStream != null)
    {
          using (var reader = new StreamReader(resourceStream, Encoding.UTF8))
          {
                            _msg = await reader.ReadToEndAsync();
           }
    What I missed?

  2. #2
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,597

    Re: why I still receiving Null when calling GetManifestResourceStream?

    I'm assuming asp.net basic since you posted here.
    You may need to incorporate the "~" char .
    This is not for your assembly but it will help you understand the usage.
    https://stackoverflow.com/questions/...eb-application
    ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ
    πλάγχθη, ἐπεὶ Τροίης ἱερὸν πτολίεθρον ἔπερσεν·

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width