title: How to tell if code is running locally from Visual Studio/Cassini
body: <p>I have an interface, let's call it <code>ILocateLogFile</code>, with a standard implementation for dev/beta/production servers, and one that only works in the local development environment.  I can't seem to think of a nice clean way to decide (preferably at compile time, but runtime would be fine) if I'm running locally or on a server.  This is a WCF application hosted on IIS, if that matters.</p>
  
  <p>The best I've come up with is to use a compiler symbol, something like:</p>
  
  <pre><code>    ILocateLogFile locateLogFile;
  #if DEBUG
      locateLogFile = new DevSandboxLogFileLocator();
  #else
      locateLogFile = new LogFileLocator();
  #endif
  </code></pre>
  
  <p>The problem is, compile symbols get set by the build, which I don't control, and I want to be certain.  Isn't there some automagical way to check for the presence of Visual Studio?  Or at least to check for Cassini rather than IIS?</p>