Where can I find the API specification for MvcTextTemplateHost?

后端 未结 5 1739
迷失自我
迷失自我 2021-01-02 18:53

I\'m trying to use a custom T4 template for adding new Controllers to a MVC 3 project. I have my own template as Scott Hanselman wrote on http://www.hanselman.com/blog/Modif

5条回答
  •  一整个雨季
    2021-01-02 19:28

    using Microsoft.VisualStudio.Web.Mvc.Scaffolding.BuiltIn;
    using Microsoft.VisualStudio.Web.Mvc.UserInterface;
    

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.10.0.dll Microsoft.VisualStudio.TextTemplating.10.0.dll

    C:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.VisualStudio.TextTemplating.10.0\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.TextTemplating.10.0.dll Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll

    C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE Microsoft.VisualStudio.Web.Mvc.4.0.dll

    If you add theses as references to your ASP.NET MVC Web project and set it to the correct dll for your MVC version (last dll reference above) 2.0 3.01 0r 4.0 (still Beta)

    You can copy the T4 code (not the tags) in and run it in a controller which will give intellisense and debugability you would need to set the right properties data and so on, on the MvcTextTemplateHost object on creation and populate it with meaningful data to see what it is doing (in theory this will work I hope)

    As previously stated opening these in .NET Reflector will divulge some info. I have not looked into the code of MVCScaffolding the source is on codeplex its on my todo list). Question i have at the moment is what with and how are the RelatedProperties populated in the MvcTextTemplateHost when it runs in VS.NET 2010 T4.

    Also can make use of Tangible T4 Editor for intellisense.

提交回复
热议问题