Search code examples
asp.net-mvcrazorrazorgeneratorprecompiled-views

MVC RazorGenerator - "Type (...) already defines a member called 'Execute' with the same parameter types"


I've been working on a big MVC Application and now i need to improve application's startup performance (which is bad +1min for the first load).

I installed RazorGenerator nugget and the extension too, but when i compile a lot of errors appear.

VS Errors

May this be caused by not specifying the Generator Type? Because i didn't find their documentation very helpful about this.

Or maybe because i added the following directive to one of my views (_EditHelperPage.cshtml) because it was rendering as HelperPage instead of WebViewPage:

@* Generator: MvcView *@

After i remove this line and adding it to razorgenerator.directives, it throws me another error:

Helper Page Error

Edit

And if i search for a class/constructor with the same name, it find results in /obj/CodeGen/(...)


Solution

  • I found the problem.

    Before i installed the VS Extension RazorGenerator (not the nugget!), i installed RazorGenerator.MsBuild which does the same as the extension but on build time (right?).

    But why was it happening? I think that the extension builds views before MsBuild, however they were doing the same and therefore creating duplicated .cs files

    I just unistalled .MsBuild package and voilá, it works.