问题
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.
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:
Edit
And if i search for a class/constructor with the same name, it find results in /obj/CodeGen/(...)
回答1:
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.
来源:https://stackoverflow.com/questions/34310485/mvc-razorgenerator-type-already-defines-a-member-called-execute-with