The type IServiceCollection is defined in an assembly that is not referenced.
For beta1/2
Short version
Install vNext packages from NuGet daily package source
TL;DR
If you are trying out ASP.NET vNext and get this error on the ConfigureServices, you probably need to add the master or daily nuget feed from ASP.Net vNext in order to get the right dependencies.
-
Update K runtime using update KVM. From a cmd window run the following command
@powershell -NoProfile -ExecutionPolicy unrestricted -Command "iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/kvminstall.ps1'))"
-
Select the new runtime by right-clicking on the web site and go to properties. The target KRE version might seem disabled, but try clicking it and select the runtime you want. With the project.json listed below I use beta2.
-
Tools > Options > NuGet Package manager > Package Sources. Click the green add and add a vNext Dalies source pointing to https://www.myget.org/F/aspnetvnext/api/v2/
-
Open nuget packages and update all your packages from the new package source or use the project.json below.
Voila, no more IServiceCollection problems.
{
"webroot": "wwwroot",
"version": "1.0.0-*",
"exclude": [
"wwwroot"
],
"packExclude": [
"**.kproj",
"**.user",
"**.vspscc"
],
"dependencies": {
"Microsoft.AspNet.Server.IIS": "1.0.0.0-beta3-10905",
"Microsoft.AspNet.Diagnostics": "1.0.0.0-beta3-11975",
"Microsoft.AspNet.Mvc": "6.0.0.0-beta3-12423",
"Microsoft.Framework.DependencyInjection": "1.0.0.0-beta3-10747"
},
"frameworks": {
"aspnet50": {
"dependencies": {
}
},
"aspnetcore50": { }
}
}