title: IServiceCollection.AddHostedService<>(); does not resolve
body: <p>I have a strange occurrence happening in a brand new .net core 2 web app. This is the standard web api from the template built into Visual Studio. VS 2017, all the jazz. Here's the the entire startup.cs:</p>
  
  <pre><code>using Microsoft.AspNetCore.Builder;
  using Microsoft.AspNetCore.Hosting;
  using Microsoft.AspNetCore.Routing;
  using Microsoft.Extensions.Configuration;
  using Microsoft.Extensions.DependencyInjection;
  using VerySimpleAPI.Helpers;
  
  namespace VerySimpleAPI
  {
      public class Startup
      {
          public Startup(IConfiguration configuration)
          {
              Configuration = configuration;
          }
  
          public IConfiguration Configuration { get; }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddMvc();
              services.AddHostedService&lt;MainLoop&gt;();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IHostingEnvironment env)
          {
              if (env.IsDevelopment())
              {
                  app.UseDeveloperExceptionPage();
              }
  
              app.UseMvc(routes =&gt; {
                  routes.MapRoute(
                      name: "Default",
                      template: "{controller}/{action}/{id?}",
                      defaults: new { controller = "Home", action = "Index"}
                      );
              });
          }
      }
  }
  </code></pre>
  
  <p><code>MainLoop</code> implements <code>IHostedService</code> and <code>IDisposable</code>.</p>
  
  <p>The <code>services.AddHostedService&lt;MainLoop&gt;();</code> does not resolve, producing the error "'IServiceCollection' does not contain a definition for 'AddHostedService' and no extension method..." all that jazz. I checked out the <code>Microsoft.Extensions.DependencyInjection</code> source, and I clearly see the definition for <code>public static IServiceCollection AddHostedService&lt;THostedService&gt;(this IServiceCollection services)</code></p>
  
  <p>Without the hosted service reference, the project compiles just fine. Is there something I'm missing?</p>