【问题标题】:Default editor for tt template and syntax colouringtt 模板和语法着色的默认编辑器
【发布时间】:2010-06-29 08:17:20
【问题描述】:
我在 vs2010 中安装了有形的 t4 编辑器扩展,它为 t4 模板 (.tt) 提供了一些基本的语法着色。
当我通过向导添加 t4 模板时,它会以语法着色打开。
关闭文件并双击后,它会以语法着色再次打开。
关闭文件并使用“打开方式”菜单并选择默认值:“自动编辑器选择”后,它会以 xml 文件语法着色打开。
这很奇怪,因为我一直认为双击等于默认的“打开方式”菜单项。你知道发生了什么事吗?
在不使用向导的情况下添加 t4 模板时会出现问题 - 没有语法着色。
【问题讨论】:
标签:
visual-studio-2010
visual-studio
editor
t4
tangible-t4-editor
【解决方案1】:
我知道的解决方案是编辑项目文件。
默认情况下,带有<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>