tags:

views:

605

answers:

2

I get the following error when attempting to use both the MVC Futures library (Microsoft.Web.Mvc) and the ASP.NET MVC source code in the same solution:

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=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

I have removed the GAC reference to System.Web.Mvc in the Web.config file so that the project will use the project reference to the MVC source code. Any idea how to get around this?

A: 

So does this work if you remove the reference to the MVC Futures assembly? As far as I know, the Microsoft.Web.Mvc namespace doesn't override the System.Web.Mvc.Controller class, and hence shouldn't conflict with the actual MVC assembly..

JMs
If I remove the reference to Microsoft.Web.Mvc then everything works perfectly. Add it back in and kaboom.
JC Grubbs
Did you upgrade the project from an earlier version of ASP.NET MVC? I've had my fair share of odd errors when doing so.
JMs
+1  A: 

I think that the problem is that your application and the version of the Futures library you are using reference different versions of the System.Web.Mvc assembly. You need to examine every assembly involve carefully, and make sure the dependencies align. This may require getting a new version of Futures or removing System.Web.Mvc from the GAC, depending upon the precise nature of the problem you uncover.

I'm going to dispute this bit of the question:

I have removed the GAC reference to System.Web.Mvc in the Web.config file so that the project will use the project reference to the MVC source code.

Removing this doesn't always seem to stop the ASP.NET compiler (different from the VS compiler) from finding the MVC assembly in the GAC. We ran into just this problem when trying to make projects built with RC 1 and Preview 5 coexist.

Craig Stuntz
Thanks Craig, I did get a response from the MVC team on this and it looks like the Microsoft.Web.Mvc assembly references the strong named assembly for System.Web.Mvc so the only way to solve this is to recompile the MVC Futures source...I haven't been able to find the Futures source yet though.
JC Grubbs
The futures source is in the regular MVC source download.
Craig Stuntz
Direct link to RC 2 futures source:http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24142
Craig Stuntz