title: Unable to resolve service for type 'Microsoft.Extensions.Configuration.IConfigurationRoot' while attempting to activate 'TheWorld.Startup'
body: <p>Seems like I'm having some sort of mismatching reference problem (Sorry, Im very new on the ASP version).</p>
  
  <p>Im using VS 2016 creating an ASP.core app from scratch. My startup class goes like:</p>
  
  <pre><code>public class Startup
      {
          private IHostingEnvironment _env;
          private IConfigurationRoot _config;
  
          public Startup(IHostingEnvironment env, IConfigurationRoot config)
          {
              _env = env;
  
              var builder = new ConfigurationBuilder()
                  .SetBasePath(_env.ContentRootPath)
                  .AddJsonFile("config.json");
  
              _config = builder.Build();
          }
  
          // This method gets called by the runtime. Use this method to add services to the container.
          // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=398940
          public void ConfigureServices(IServiceCollection services)
          {
              services.AddSingleton(_config);
  
              if(_env.IsEnvironment("Development"))
                 services.AddScoped&lt;Services.IMailServices, Services.DebugMailService&gt;();
  
              services.AddMvc();
          }
  
          // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
          public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
          {
  
              if(env.IsDevelopment())
                 app.UseDeveloperExceptionPage();
  
              app.UseStaticFiles();
              app.UseMvc(config =&gt;
              {
                  config.MapRoute(name: "Default",
                  template: "{controller}/{action}/{id?}",
                  defaults: new { controller = "App", action = "Index" }
                  );
               });
          }
      }
  </code></pre>
  
  <p>Im having a hard time with the 'IConfigurationRoot' though. I've added its reference via IDE, and the project.json looks like this:</p>
  
  <pre><code>{
    "dependencies": {
      "Microsoft.NETCore.App": {
        "version": "1.0.1",
        "type": "platform"
      },
      "Microsoft.AspNetCore.Diagnostics": "1.0.0",
      "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
      "Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
      "Microsoft.Extensions.Logging.Console": "1.0.0",
      "Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
      "Microsoft.AspNetCore.Mvc": "1.1.3",
      "Microsoft.AspNetCore.Mvc.TagHelpers": "1.1.3",
      "Microsoft.Extensions.Configuration.FileExtensions":  "1.0.0",
      "Microsoft.Extensions.Configuration.Json": "1.0.0"
    },
  
    "tools": {
      "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
    },
  
    "frameworks": {
      "netcoreapp1.0": {
        "imports": [
          "dotnet5.6",
          "portable-net45+win8"
        ]
      }
    },
  
    "buildOptions": {
      "emitEntryPoint": true,
      "preserveCompilationContext": true
    },
  
    "runtimeOptions": {
      "configProperties": {
        "System.GC.Server": true
      }
    },
  
    "publishOptions": {
      "include": [
        "wwwroot",
        "web.config"
      ]
    },
  
    "scripts": {
      "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
    }
  </code></pre>
  
  <p>You guys can spot any silly mistake(s) in here?</p>
  
  <p>Cheers</p>