GetManifestResourceStream returns NULL

前端 未结 13 2681
走了就别回头了
走了就别回头了 2020-11-28 05:41

This is a C# .NET 4.0 application:

I\'m embedding a text file as a resource and then trying to display it in a dialog box:

    var assembly = Assembl         


        
13条回答
  •  暖寄归人
    2020-11-28 05:54

    Here is the cause of my null value.

    http://adrianmejia.com/blog/2011/07/18/cs-getmanifestresourcestream-gotcha/

    The GetManifestResourceStream method will always returns NULL if the resource ‘built action‘ property is not set to ‘embedded resource‘

    After setting this property with all the needed files assembly.GetManifestResourceStream starts returning the correct stream instead of NULL.

提交回复
热议问题