0

我在vs2010中安裝了有形的t4編輯器擴展,它爲t4模板(.tt)提供了一些基本的語法着色。tt模板和語法着色的默認編輯器

當我通過嚮導添加t4模板時,會打開語法着色。

關閉文件後,雙擊它,打開語法着色。

關閉文件並使用「打開方式」菜單並選擇默認值:'自動編輯器選擇'後,將打開xml文件語法着色。

這很奇怪,因爲我總是認爲雙擊等於默認的'打開'菜單項。你知道發生了什麼事嗎?

當不使用嚮導添加t4模板時就會出現問題 - 沒有語法着色。

回答

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>