Embedded Resources is a mechanism in scripts that lets you “carry along” any files right next to the script — images, videos, ML models, executables, and even DLLs.
Images can be used in your custom UI, videos may contain training materials, and DLLs — additional code that for some reason is inconvenient to ship as a NuGet package.
Please note: when a library exists on NuGet, it is far more reliable to use #r "nuget:" and reference the package rather than a raw DLL file.
Right-click the script’s file tree (the Show Files button toggles it) -> Add Existing File...

Or via the New button.
After you add a file, it will appear in the list and can be selected.

To remove a resource, just delete the file from the list.
Now, when the script starts, the files you selected will be loaded automatically and the script will be able to use them.
This method reads the file contents as text or as bytes. What you do with those bytes is up to you.
var fontData = GetService<IScriptFileProvider>().ReadAllBytes("Roboto-Regular.ttf");
When building UI via Blazor, you can also use files directly. For example, if you added Image 12.jpg to the script, to display it you just write:
<img src="Image 12.jpg" />
Exactly the same way you can show videos, load text, styles, and everything else.
Similar to NuGet packages, you can include a needed DLL directly in the script and still have code completion, type discovery, etc.
All you need to do is:
Script.csx write#r "assemblyPath: MyDll.dll"
That’s it. When compiling the script, EyeAuras will look for a matching DLL among the project’s resources and use it. And when the script runs — it will load it from resources. No loose files lying around.
EyeAuras can export a script as a full C# .sln and then you can open it in JetBrains Rider or Visual Studio.
Embedded resources (files) are exported too and marked as Embedded Resource.
For example, in the case of Image 12.jpg, first, the file itself will be exported into the target folder, and second, the exported project file will contain:
<ItemGroup>
<EmbeddedResource Include="Image 12.jpg" />
<None Remove="Image 12.jpg" />
</ItemGroup>
This tells the C# compiler to include Image 12.jpg as an embedded resource inside the final DLL.
When importing the .sln back, EyeAuras reads Embedded Resource items and you will see them as files in the list.
In Visual Studio/Rider this is Build Action = EmbeddedResource. If you opened the exported project, you can:
On import back, EyeAuras will scan the .csproj, find all EmbeddedResource items, and show them in the script’s file list. Names and relative paths are preserved — this is important for correct access from code/Blazor.

When building scripts, EyeAuras follows the official compiler’s logic as closely as possible — the files you added will be included as Embedded Resources in the final DLL, visible and accessible via Assembly.GetManifestResourceNames and Assembly.GetManifestResourceStream.
A quick refresher on .NET methods:
A “brute force” example (usually you don’t need this — use IScriptFileProvider):
var asm = typeof(Script).Assembly; // your script’s assembly
foreach (var name in asm.GetManifestResourceNames())
{
Log.Info($"Resource: {name}");
}
using var stream = asm.GetManifestResourceStream("MyScript.Images.logo.png");
using var ms = new MemoryStream();
stream.CopyTo(ms);
var bytes = ms.ToArray();
In EyeAuras, it’s more convenient to use IScriptFileProvider which maps paths and finds the right resource for you.
One peculiarity of C# Embedded Resources is that when resources are included in a DLL, the relative path is “folded” and turns into namespace.folder.filename.
How the full resource name is formed during build:
How to find a resource in EyeAuras:
Important about matches and case sensitivity:
Examples of queries that work for Images/logo.png:
EyeAuras tries to make life easier for users and supports both full names (with dots) and relative ones (without namespace). You can also use natural paths like folder/Image 12.jpg instead of folder.Image 12.jpg.
var files = GetService<IScriptFileProvider>();
var json = files.ReadAllText("config.json");
var cfg = JsonConvert.DeserializeObject<MyConfig>(json);
var files = GetService<IScriptFileProvider>();
var model = files.ReadAllBytes("models/my_model.onnx");
// pass the bytes into your ML library
var files = GetService<IScriptFileProvider>();
var file = files.GetFileInfo("video/tutorial.mp4");
using var stream = file.CreateReadStream();
// read in chunks without holding everything in memory
<img src="Images/logo.png" />
At compile time
#r "assemblyPath: MyLib.dll"
At runtime
Helpful example:
#r "assemblyPath: Newtonsoft.Json.dll"
using Newtonsoft.Json;
Log.Info(JsonConvert.SerializeObject(new { Hello = "World" }));
var asm = typeof(Script).Assembly;
foreach (var name in asm.GetManifestResourceNames())
{
Log.Info($"Resource: {name}");
}
var files = GetService<IScriptFileProvider>();
foreach (var fi in files.GetDirectoryContents("/"))
{
Log.Info($"Found: {fi.Name} ({fi.Length} b)");
}
var files = GetService<IScriptFileProvider>() as ScriptEmbeddedResourceFileProvider;
var names = files?.GetManifestNames() ?? Array.Empty<string>();
Log.Info(string.Join("\n", names));
File is not found
Duplicate names
Large files
I changed the file but don’t see updates
DLL does not load
#r "assemblyPath: ..." points to the correct file.Dots or slashes in paths?