title: Access ASP.NET MVC paths from outside the hosting environment
body: <p><strong>Background:</strong>
  I have a ASP.NET MVC3 app, with a database. I also have a complex console app, which (amongst other things) initialises the web app's database: generate, add constraints, add sprocs, add triggers, seed, etc. I cannot move the console logic into the web app (doesn't make sense in our architecture).</p>
  
  <p><strong>Problem:</strong>
  The console app is obviously not running in a hosted environment, so does not have access to <code>HostingEnvironment</code>, <code>MapPath</code>, <code>HttpContext.Current</code>, <code>Server.MapPath</code>, <code>~</code>, etc. But I need access to the web app's paths from the console app. Also, the console app calls into the web app, which then uses these classes normally, but which are of course all null or undefined.</p>
  
  <p><strong>Question:</strong>
  Is there some way to spoof one of these classes so that I can access the hosting environment's path mechanism, even though it's not running?</p>
  
  <p>I can hardcode all the paths I need into the console app, but that is highly undesirable.</p>
  
  <p>I'm under the impression that this should be possible, because the same need would be required for unit testing.</p>
  
  <p>TIA</p>