title: IHostingEnvironment.WebRootPath is null when using EF7 commands
body: <p><strong>Problem</strong></p>
  
  <p>When I try to add a migration to my code, e.g: <code>dnx ef migrations add initial</code>, </p>
  
  <p>the <code>env.WebRootPath</code> in <code>Startup(IHostingEnvironment env)</code> is null.</p>
  
  <p>This will give me compilation errors when adding a new migration or updating the database.</p>
  
  <p><strong>The Code</strong></p>
  
  <p>In the <em>Startup.cs</em> class I have these lines in the constructor:</p>
  
  <pre><code>public Startup(IHostingEnvironment env)
  {
      // ...
      MyStaticClass.Initialize(env.WebRootPath);
      // ...
      _hostingEnvironment = env;
  }
  </code></pre>
  
  <p>Here <code>env.WebRootPath</code> is null and in the <code>Initialize</code> function this throws an exception.</p>
  
  <p>In the <em>ConfigureServices</em> function of the <em>Startup.cs</em> I resolve my class dependencies:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      // ...
      services.AddInstance&lt;IMyService&gt;(new MyService(_hostingEnvironment.WebRootPath))
      // Note: _hostingEnvironment is set in the Startup constructor.
      // ...
  }
  </code></pre>
  
  <p><strong>Notes</strong></p>
  
  <ul>
  <li><p>I can build, run, and deploy the code fine. Everything works!</p></li>
  <li><p>However I made a change in the model and want to add a migration with this command: <code>dnx ef migrations add MyMigration</code> then I see the compilation errors in the package manager console.</p></li>
  <li><p>I am using ASP 5 web application, and Entity Framework 7</p></li>
  </ul>