MVC RazorGenerator - “Type (…) already defines a member called 'Execute' with the same parameter types”

点点圈 提交于 2019-12-11 11:49:01

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!