Getting Compiler Error CS1705 with System.Web.WebPages

Jun 22, 2014 at 5:51 AM
I'm using the latest Visual Studio 2012 RazorGenerator extension with an MVC 3 project. I have a Helpers folder for my view helpers, all using Generator: WebPagesHelper and the Custom Tool property is set to RazorGenerator. I added the view helper namespace in my Web.config. When I navigate to a page using one of the helpers, I get the following error:

Compiler Error Message: CS1705: Assembly 'MyProject.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' uses 'System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' which has a higher version than referenced assembly 'System.Web.WebPages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

Any ideas what's going on?

Thanks,
Andrew
Jun 22, 2014 at 10:55 PM
I have some further details on my issue from above. This only happens when one of my helpers is referencing another helper. Also, I tried moving the helpers into App_Code to see if there was any difference, and there was, but it wasn't in the right direction. When placed in App_Code, I get the same Compiler Error Message, but on every page, not just the ones referencing the helpers. My generated code is always set with a Build Action of Compile.
Coordinator
Jun 23, 2014 at 5:04 PM
With MVC3, you should be using WebPages 1.0 throughout. Do you maybe have some binding redirects that cause 2.0 to get in the picture?
Jun 24, 2014 at 1:34 AM
Correct, I should be using WebPages 1.0 throughout, and until now I thought I was. I searched my solution for "2.0.0" and "system.web.webpages", but did not find anything that linked the two. I only see this when a helper is calling another helper and I have generated code. Is there any way the generated code or the RazorGenerator VisualStudio tool be causing the use of System.Web.WebPages 2.0.0?
Coordinator
Jun 24, 2014 at 5:12 AM
I wouldn't think so. Do you have a small test repo you can share (e.g. on GitHub) that demonstrates the issue? That would really help investigate.
Jun 24, 2014 at 4:58 PM
Unfortunately I only tried doing this on a company project, so I cannot share it with you. If I have time, I'll try setting this up in a fresh MVC 3 project. This should help me determine if the problem is coming from the project I'm working on, or RazorGenerator. Thanks.