How do I read an embedded resource (text file) using StreamReader
and return it as a string? My current script uses a Windows form and textbox that allows the
Some VS .NET project types don’t auto-generate a .NET (.resx) file. The following steps add a Resource file to your project:
Resources
.Now you can add a text file as a resource, for example an xml file:
Resources
has a property of type string
that is named after the included file. If the file name is e.g. RibbonManifest.xml, then the property should have the name RibbonManifest
. You find the exact name in the code file Resources.Designer.cs.string xml = Resources.RibbonManifest
. The general form is ResourceFileName.IncludedTextFileName
. Don’t use ResourceManager.GetString
since the get-function of the string property has done that already.