1

Closed

RazorGenerator.MsBuild does not support ASP.Net MVC 5.1 or 5.2 (versions > 5.0)

description

RazorGenerator does not currently support MVC versions > 5.0 (i.e. 5.1 and 5.2)

In environments such as build servers, where Visual Studio is not installed, projects utilizing the latest version of RazorGenerator and MVC versions > 5.0 will not be able to build unless version 5.0 of the System.Web.MVC assembly is manually loaded in to the GAC on the build server.

Since Visual Studio (2013 anyways) registers MVC 5.0 assemblies in the GAC, this is not an issue on machines where Visual Studio is installed. In production environments, this is also typically a non-issue, as binding redirection will make sure that the correct version of System.Web.MVC is referenced at runtime, even if 5.0 is referenced.
Closed Mar 17, 2015 at 5:20 PM by davidebbo
Closing here since this is now tracked on https://github.com/RazorGenerator/RazorGenerator/issues/2

comments

davidebbo wrote Jan 9, 2015 at 4:28 AM

Can you please clarify how you are using RazorGenerator? Is this with the RazorGenerator.MsBuild package?

jsholzer wrote Jan 9, 2015 at 7:31 PM

Yes, we are using RazorGenerator with the RazorGenerator.MsBuild package

davidebbo wrote Jan 12, 2015 at 1:09 AM

I changed the title accordingly. BTW, what specific error are you getting?

Jignasa wrote Jan 19, 2015 at 3:10 PM

Hi David,
I just started exploring RazorGenerator.MVC and RazorGenerator.MsBuild 2.3.0 option for our site that we are trying to convert to MVC. We are using .Net Framework 4.5.2 and corresponding MVC - 5.2.2.0 (System.Web.MVC.dll)
I found the issue by debugging that the RazorGenerator.MsBuild package missing required System.Web.Mvc.dll under
RazorGenerator.MsBuild.2.3.0\tools\v3. It requires only specific version of that dll (5.0.0). Using higher version doesn't work either. Can you please update the Nuget package accordingly. Please let me know if more information needed.

Jignasa wrote Jan 22, 2015 at 8:46 PM

Hi David,
Can you please look into the issue of missing System.Web.Mvc.dll ( version 5.0.0.0) under V3 folder of RazorGenerator.MsBuild package?

davidebbo wrote Jan 27, 2015 at 7:55 PM

Right now, we're blocked by the ability to even build the VSIX on machines without VS2010. Once this is addressed,
it will become easier for anyone to send PRs for this kind of changes.

SliverNinja wrote Mar 17, 2015 at 3:58 PM

This issue wasted an entire day, please remove RazorGenerator.MsBuild 2.3.0. Don't waste peoples time if it's known to cause an issue.

I added this to the new GitHub home

@Jignasa - thanks for identifying the root cause, as the symptoms are very strange. For us - it was complaining about being unable to resolve class references - despite their namespaces being present in Views\web.config.

Once corrected with full namespace path, it would complain "Error 1
Could not precompile the file '\Views\Shared\myviewname.cshtml'. Ensure that a generator declaration exists in the cshtml file.
A generator declaration is the first line of your cshtml file and looks like this:
@* Generator: MvcHelper *@
Valid host names: MvcHelper, MvcView, Template, WebPagesHelper, WebPage, RazorGenerator.Core.IHostProvider ..\packages\RazorGenerator.MsBuild.2.3.0\build\RazorGenerator.MsBuild.targets 21 9 My Project

The workaround is to manually copy the MVC 5 assembly from the previous package or locally (System.Web.Mvc.dll) and place it under \packages\RazorGenerator.MsBuild.2.3.0\tools\v3

Please correct this!