George V. Reilly

NVelocity: loading templates from embedded resources


In last week’s tip on using the NVelocity template formatting engine, I described what to set to load a template from an absolute path.

Here’s the magic necessary to get NVelocity to load a template from an embedded resource:

VelocityEngine engine = new VelocityEngine();
ExtendedProperties properties = new ExtendedProperties();
properties.AddProperty("resource.loader", "assembly");
    "NVelocity.Runtime.Resource.Loader.AssemblyResourceLoader, NVelocity");
properties.AddProperty("assembly.resource.loader.assembly", "StencilFormatter");
blog comments powered by Disqus
NVelocity templates and absolute paths » « Damn Right We're Angry