Upgrading to ASP.NET MVC 2/.net 4
July 13, 2010 · 1 minute read
We have recently upgraded a few projects to .net 4 (and MVC 2) and have invariably hit one particular error message.
We are using the Spark view engine, and having upgraded the project to MVC 2 would see this error…
Dynamic view compilation failed. (0,0): warning CS1701: Assuming assembly reference ‘System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ matches ‘System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’, you may need to supply runtime policy
Google helped us find this post, which explains that any referenced assemblies which in turn reference MVC 1 could be causing this issue.
After a prolonged process of checking and upgrading various assemblies, we eventually discovered that we needed to update our _Global.spark file.
This file (for those who haven’t used it) is a useful place to put anything which all the spark pages in your project need to include.
Ours looked like this…
We’d upgraded most of these to the latest versions, except for xVal. Removing xVal from this list fixed the problem. As it happens we were no longer using xVal (in the spark pages) so we didn’t need it in there anyway.