工作,我不能讓autofac工作,我已經看過這個potentially duplicate問題,但它並不能幫助。獲取Autofac與MVC6/ASP.NET5
我使用的是完整的.NET堆棧,DNX 4.5.1
我已經包括以下依賴性。
"dependencies": {
// matched latest autofac version with latest dependencyinjection version.
"Autofac": "4.0.0-beta8-157",
"Autofac.Framework.DependencyInjection": "4.0.0-beta8-157",
"Microsoft.AspNet.Mvc": "6.0.0-rc1-final" ...
和下面的初始化代碼。
// void?
public void ConfigureServices(IServiceCollection services)
{
services.AddMvc();
var container = new ContainerBuilder();
...
// compilation error here!
container.Populate(services);
}
我收到此錯誤:
Error CS1503 Argument 2: cannot convert
from'Microsoft.Extensions.DependencyInjection.IServiceCollection' to
'System.Collections.Generic.IEnumerable<Microsoft.Framework.DependencyInjection.ServiceDescriptor>'
MuWapp.DNX 4.5.1 C:\MuWapp\Startup.cs 54 Active
我認爲所有的NuGet包版本應該匹配(你的β-8和RC-1混合)。 –
對於autofac沒有rc-1,所以如果你正確的話,autofac還不支持rc1? 這意味着RC有突破性的變化,這是有點偏離! – Jim