0

我将 ASP.NET MVC 2 RC2 源代码添加到我的解决方案中(使用这些说明:http: //blog.stevensanderson.com/2009/02/03/using-the-aspnet-mvc-source-code-to-debug -your-app/),但现在由于 Autofac 的错误而无法构建。

The type 'System.Web.Mvc.IControllerFactory' is defined in an assembly
that is not referenced. You must add a reference to assembly
'System.Web.Mvc, Version=1.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.

对 MVC 版本 1 的引用让我特别困惑。甚至在我添加 MVC 源代码之前,我使用的是 MVC 2(来自二进制文件)并且 Autofac 没有抱怨。

4

2 回答 2

1

Autofac.Integration.Web 程序集引用 System.Web.Mvc。您没有说您使用的是哪个版本的 Autofac,但如果您乐于使用 Autofac 版本 2(当前为测试版),那么有一个可用于 .NET 4 的构建。请参阅http://code.google.com/p /autofac/issues/detail?id=162了解详情。

于 2010-02-02T23:20:19.310 回答
0

正如 eu-gene-ne 提到的,尝试组装绑定。我的 Autofac 1.4 在 MVC 2 RC 上运行得很好,尽管被引用为一个程序集。

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

我真的不能说为什么在您的解决方案中包含 MVC 项目而不是引用它会有所作为。

于 2010-02-03T21:14:39.960 回答