1

I recently added MVC Foolproof Validation to a new MVC4 app, and now every time I try and scaffold a view using the Add View wizard, I get the following exception [shortened for brevity]:

C:\Projects2012\Comair.RI\Comair.RI.UI\CodeTemplates\AddView\CSHTML\Details.tt(0,0) : error : Running transformation: System.TypeInitializationException: The type initializer for 'Foolproof.ContingentValidationAttribute' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.

NOTE: I have found simply commenting out the Foolproof attributes in the view model, and then rcompiling, allows the scaffolding to work again. Then I can uncomment the Foolproof stuff and it seems to work.

ProfK
  • 49,207
  • 121
  • 399
  • 775

2 Answers2

0

Foolproof references .net 3.5 and MVC 2. Download the source http://foolproof.codeplex.com/SourceControl/changeset/view/94877, change the references, recompile and add the new Foolproof dll to your app.

(when I did this I had to make a couple of changes to the project xml as there were a couple of bits that were not included in the downloaded files).

atreeon
  • 21,799
  • 13
  • 85
  • 104
0

You need to have ASP.NET MVC 2 installed on your system.

You can download it from here: http://www.microsoft.com/en-us/download/details.aspx?id=22079

Radu Damian
  • 1,051
  • 10
  • 8