title: Using Razor Engine in a console application
body: <p>I am using the <a href="http://razorengine.codeplex.com/" rel="noreferrer">Razor Engine from CodePlex</a> in a console application.  When I run in debug mode in VS 2010 IDE, everything works.  From the shell, even a simple 2-liner in the example on the above CodePlex page fails.  So I don't think it's the code.  The exception message is as generic as it can be:  </p>
  
  <pre><code>RazorEngine.Templating.TemplateCompilationException: Unable to compile template.
  </code></pre>
  
  <p>All the DLLs which are referred to (in the References section) are there in the working directory along with the .exe which is the console application itself.  I won't put the entire list here, but here are some that I think are relevant: <strong>System.Web</strong>, <strong>System.Web.Mvc</strong>, <strong>System.Web.Razor</strong>, <strong>RazorEngine</strong>, etc. I don't think DLLs such as <strong>System</strong>, <strong>System.Xml</strong>, etc even need to be there but to eliminate any surprise, I copied them there anyway.  The point is whatever is in the References section are copied to the working directory where the exe is.  The surprise is it still doesn't work.  How can I track down what's missing or just getting this thing to work?         </p>
  
  <p><strong>Edit</strong> I just created a bare bone console app to demonstrate my point.  Here's the entire program.  As I mentioned, it works fine from inside the IDE, not in the shell.</p>
  
  <pre><code>using System;
  using RazorEngine;
  
  namespace RazorEngineTest
  {
      public class Program
      {
          public static void Main(string[] args)
          {            
              string template = "Hello @Model.Name! Welcome to Razor!";
              string result = Razor.Parse(template, new { Name = "World" });
              Console.WriteLine(result);
              Console.ReadLine();
          }
      }
  }
  </code></pre>