1
Vote

Specific version of System.Web.Mvc set to true causes unit test failures

description

A bunch of my unit tests started failing when I added xVal to my MVC2 application. The unit test failures started when I added a using statement of "xVal.ServerSide" so that I could catch RulesExceptions. The error message was:
 
System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
 
After poking around, I realized that I didn't have MVC1 installed and that the issue had to be with xVal. The ironic part was that it would not throw the error when debugging the web application, but it would fail in the unit tests. I recompiled the xVal project with specific version set to false on the System.Web.Mvc and all my problems disappeared.

comments