views:

2397

answers:

8

I am looking for a .net templating engine - something simple, lightweight, stable with not too many dependencies. All I need it for at the moment is creating templated plain text and html emails. Can anyone give me a good recommendation?

If it helps at all - something like Java's Freemarker or Velocity libraries.

[UPDATE] Thanks for the answers so far - much appreciated. I am really intested in recommendations or war stories from when you have used these libraries. Seems to be the best way to make a decision without trying each in turn.

A: 

Have you seen NVelocity, a .NET port of Velocity? http://nvelocity.sourceforge.net/

MattValerio
Yes - google found that, but it doesn't look very active. Nothing since 2003. Have you used it?
serg10
its forked by Castle at http://www.castleproject.org/castle/projects.html
jhexp
A: 

http://csharp-source.net/open-source/template-engines

http://joel.net/code/dotnet_templates.aspx

Hope this helps!!!

Samiksha
Have you used any the libraries listed in the first link?
serg10
+12  A: 

Here's a couple more:

About NVelocity, it has been forked by the Castle guys, it's being developed here (log)

For emails, I've never needed more than NVelocity.

Mauricio Scheffer
Thanks for that mausch. Have you had any issues with NVelocity?
serg10
Yes, there are some minor issues, for example this one: http://forum.castleproject.org/viewtopic.php?t=4781
Mauricio Scheffer
+2  A: 

string template from the anltr.org folks with a C# version too.

kenny
+4  A: 

More Complete List

  • ASP.Net inbuilt WebForm View Engine
  • ASPView
  • Brail
  • NHaml (.Net port of Haml)
  • Spark
  • NVelocity
  • StringTemplate.Net
Palani
+1  A: 

Another one that may be useful: http://www.stefansarstedt.com/templatemaschine.html

Ilya
A: 

I'm trying to deal with the same issue, and have been looking into the various view engines available for ASP.NET MVC. Basically, I need to take the incoming model data and generate XML to send to a web service. Either it feels like I'm jamming something where it doesn't belong, having trouble providing the template myself (everything seems designed to have you point to a file path), or something else. Any thoughts?

Rich
+1  A: 

I've just released an open source project. It's aimed principally at email templating but you could use the parser by itself if you wanted to. You can read some more details and grab the source code from my blog.

http://thecodedecanter.wordpress.com/2010/07/19/town-crier-an-open-source-e-mail-templating-engine-for-net/

Oenotria