I've been trying to set up the ASP.NET MVC 2 RTM Source for use with my app, so I can step through things like model binding when debugging. However, I haven't been able to get it to work - I'm getting errors like:
The type 'System.Web.Mvc.Controller' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
The type 'System.Web.Mvc.Async.AsyncControllerActionInvoker' is defined in an assembly that is not referenced.
You must add a reference to assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35'.
Etc...
I followed the steps in Steve Sanderson's howto (for MVC1), but perhaps there are different steps to get it to work in MVC2?
Steps I have taken so far:
- Removed references to GAC based
System.Web.Mvc dll
from all of my projects. - Added the MVC source as a project in the solution.
- Added references to the System.Web.Mvc project in each of my projects.
- Commented out the
<add assembly="System.Web.Mvc...
item in the<compilation><assemblies>
section of the rootweb.config
- Commented out the
<add assembly="System.Web.Mvc...
item in the section of theweb.config
in theViews
folder (and theViews
folders of each of the areas) - Find/replaced any of the references to
System.Web.Mvc, Version=2.0.0.0
and replaced theirPublicKeyToken
value withnull
(was 31bf3856ad364e35)
So, questions:
- has anyone else got this working? (presumably yes!)
- Where are the
PublicKeyToken
numbers coming from in the errors? - There are some other references to this same
PublicKeyToken
(31bf3856ad364e35) for other dlls in theweb.config
(e.g.System.Web.Extensions
) is this relevant? - Any idea what I'm doing wrong?! Steps I've missed?
Thank you!
UPDATE: In response to Syd's questions, here's some extra info:
1) Current assemblies node from web.config:
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Abstractions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
2) Yes, I am using MVC Futures, but have that project built in my solution too, and have referenced it to use the System.Web.Mvc in the solution.
3) I am using a few non-standard references. Rather that a screenshot I'll list them here:
Autofac
Autofac.Integration.Web
Autofac.Integration.Web.Mvc
Elmah
FluentValidation
FluentValidation.Mvc
log4net
MvcContrib
MySql.Data
NHibernate
MvcFutures