NTDLS.EmbeddedResource Usage
Reading files embedded in your assembly and formatting them with placeholder values.
NTDLS.EmbeddedResource
What it is. A small helper library for reading files that are compiled into your .NET assembly as embedded resources. Its Format method reads the resource text and substitutes placeholder values, so you can ship templates - SQL scripts, email bodies, config snippets - inside the executable itself.
When to reach for it. You want template files to travel with your deployment (no loose files to lose or misconfigure) and you need simple value substitution without a full templating engine. Skip it if your templates need loops, conditionals or nested includes; this is a lightweight reader/formatter, not a template language.
Getting started
First, mark the file as an embedded resource in its project properties (Build Action = Embedded Resource). Then read and format it by its path relative to the project root:
// Suppose TextFiles\TestResource.txt contains:
// Hello {0}! Thanks for trying our product.
var formattedText = EmbeddedResourceReader.Format(@"TextFiles\TestResource.txt", ["World"]);
Console.WriteLine(formattedText);
The array you pass supplies the values for the placeholders in order. Because the text lives inside the assembly, the call works from any working directory and needs no file-system access at runtime - handy for single-file deployments and services.
NuGet: NTDLS.EmbeddedResource