Using .NET Core, I solved this problem by defining a function as follows
public static string InlineFile(string path)
{
return System.IO.File.ReadAllText("wwwroot/" + path);
}
and then calling it in a view as
The reason behind separately defining the function is to avoid changing all paths in case the hosting environment changes. Beware that you cannot inline media rules.