我在vs2010中安装了有形的t4编辑器扩展,为t4模板(.tt)提供了一些基本的语法着色。
当我通过向导添加t4模板时,它会打开语法着色。
关闭文件并双击后再次使用语法着色打开。
关闭文件并使用“打开方式”菜单并选择默认值:“自动编辑器选择”后,将打开xml文件语法着色。
这很奇怪,因为我总是认为双击等于默认的'打开方式'菜单项。你知道发生了什么吗?
如果在不使用向导的情况下添加t4模板,则会出现问题 - 没有语法着色。
答案 0 :(得分:2)
我所知道的解决方案是编辑项目文件。
默认情况下,带有<SubType>Designer</SubType>
元素的模板无法在有形t4编辑器中打开。
从更改
<None Include="Content\Data\ContentDomain\Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Context.vb</LastGenOutput>
<SubType>Designer</SubType>
<CustomToolNamespace>Content.Data</CustomToolNamespace>
</None>
到这个
<None Include="Content\Data\ContentDomain\Context.tt">
<Generator>TextTemplatingFileGenerator</Generator>
<LastGenOutput>Context.vb</LastGenOutput>
<CustomToolNamespace>Content.Data</CustomToolNamespace>
</None>