I tried to use razor generator but found there is an issue if the razor file contains "Helper"
I created file name TestHelper.cshtml:
```
@{
ViewData["placeholder"] = ViewData.ModelMetadata.Watermark;
}
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, ViewData)
```
The generated code is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Web.Common.Mvc.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;
using MvcSiteMapProvider.Web.Html.Models;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
public class TestHelper : System.Web.WebPages.HelperPage
{
}
}
#pragma warning restore 1591
```
If I remove the Helper from TestHelper.cshtml become Test.cshtml, the generated code is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Web.Common.Mvc.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;
using MvcSiteMapProvider.Web.Html.Models;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/DisplayTemplates/Test.cshtml")]
public partial class _Test : System.Web.Mvc.WebViewPage<dynamic>
{
public _Test()
{
}
public override void Execute()
{
#line 1 "..\..\Views\Shared\DisplayTemplates\Test.cshtml"
ViewData["placeholder"] = ViewData.ModelMetadata.Watermark;
#line default
#line hidden
WriteLiteral("\r\n\r\n");
#line 5 "..\..\Views\Shared\DisplayTemplates\Test.cshtml"
Write(Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, ViewData));
#line default
#line hidden
}
}
}
#pragma warning restore 1591
```
I created file name TestHelper.cshtml:
```
@{
ViewData["placeholder"] = ViewData.ModelMetadata.Watermark;
}
@Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, ViewData)
```
The generated code is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Web.Common.Mvc.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;
using MvcSiteMapProvider.Web.Html.Models;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
public class TestHelper : System.Web.WebPages.HelperPage
{
}
}
#pragma warning restore 1591
```
If I remove the Helper from TestHelper.cshtml become Test.cshtml, the generated code is:
```
#pragma warning disable 1591
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.18063
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Web.Common.Mvc.Views.Shared.DisplayTemplates
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Web;
using System.Web.Helpers;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using System.Web.Mvc.Html;
using System.Web.Routing;
using System.Web.Security;
using System.Web.UI;
using System.Web.WebPages;
using MvcSiteMapProvider.Web.Html;
using MvcSiteMapProvider.Web.Html.Models;
[System.CodeDom.Compiler.GeneratedCodeAttribute("RazorGenerator", "2.0.0.0")]
[System.Web.WebPages.PageVirtualPathAttribute("~/Views/Shared/DisplayTemplates/Test.cshtml")]
public partial class _Test : System.Web.Mvc.WebViewPage<dynamic>
{
public _Test()
{
}
public override void Execute()
{
#line 1 "..\..\Views\Shared\DisplayTemplates\Test.cshtml"
ViewData["placeholder"] = ViewData.ModelMetadata.Watermark;
#line default
#line hidden
WriteLiteral("\r\n\r\n");
#line 5 "..\..\Views\Shared\DisplayTemplates\Test.cshtml"
Write(Html.TextBox("", ViewData.TemplateInfo.FormattedModelValue, ViewData));
#line default
#line hidden
}
}
}
#pragma warning restore 1591
```