We have an existing MVC application that we’re building using TeamCity and things were going great until we needed to start building a different MVC 3 application on the same build server…
After installing MVC 3, the first build error we starting receiving in the MVC 2 project was:
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.Razor.WebRazorHostFactory' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
T4MVC.cs(112, 11): error CS0012: The type 'System.Web.WebPages.StartPage' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
OK, no problem. I added these assemblies as references, and then received a different error:
CustomViewEngine.cs(44,9): error CS1502: The best overloaded method match for 'System.Web.Mvc.WebFormView.WebFormView(System.Web.Mvc.ControllerContext, string)' has some invalid arguments
So at this point, I think I’m on the stairway to heck, and I’ve reverted my changes. The underlying problem seems to be T4 noticing that MVC 3 is available, and is using MVC 3 instead of MVC 2. Could this be the case? If so, how do I fix this? There doesn’t seem to be a way to specify MVC 2 in the T4 settings file.
I’m not the developer who usually mucks around in T4, so I’m feeling a bit lost a this point!
Of course, everything is building fine locally on my workstation.
Any advice would be greatly appreciated!
OK, I found the problem.
In the MVC 2 project, the reference to System.Web.Mvc had ‘Specific Version’ set to false. This is a little unsettling since the default value for Specific Version is true for an MVC 2 project. I’m sure Mercurial will help me
point the finger at someonedetermine the source of this error.Apologies all around to any T4 gurus who looked at this question because I included the T4 tag originally!