问题
I'm running an ASP .NET (v4.5) Web Site Project under VS 2012 Update 2. When I create a new entity model (.edmx) under the App_Code folder, nested under the .edmx file is only the .Designer.cs and the .edmx.diagram files. The associated .tt files are not nested. I think this is why, when I save the model, the T4 templates are not automatically transformed, even though that option is specified in the model properties.
Any ideas how to get this working? I cannot use the DependentUpon XML tag in a project file, since Web Site Projects do not have project files.
回答1:
Web Site does not support Nested Project Files, whereas Web Applications support it.I highly you suggest to use a Web Application.
The only way that I found in past is to Run Manually T4 (Right Click on a TT File) or use a pre build event to run T4.
回答2:
Open the .tt file and choose save. This runs the T4 template.
来源:https://stackoverflow.com/questions/16270356/asp-net-entity-framework-tt-files-not-nesting-under-edmx