How to set the Custom Tool property programmatically from a VS package?
Hi,
I am writing a VS package using the cool new VSIP for Visual Studio 2005. My question is how can I set the custom tool property of an item? It does not seem to be defined as a VSHPROPID_xxxx?
Thanks.
Thanks Paul,
I eventually found out a solution described here http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=54651. I have modified the CS.vstemplate file this way:
<!--DSL Tools Language Template-->
<VSTemplate Version="2.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TemplateData>
<Name Package="{430bba70-950a-4eae-bea9-a0d43e8d5867}" ID="100"/>
<Description Package="{430bba70-950a-4eae-bea9-a0d43e8d5867}" ID="102"/>
<Icon Package="{430bba70-950a-4eae-bea9-a0d43e8d5867}" ID="401" />
<ProjectType>CSharp</ProjectType>
<SortOrder>1</SortOrder>
<DefaultName>CodeFluentLanguage.cfml</DefaultName>
<AppendDefaultFileExtension>true</AppendDefaultFileExtension>
</TemplateData>
<TemplateContent>
<ProjectItem ReplaceParameters="true">cfml.cfml</ProjectItem>
<CustomParameters>
<CustomParameter Name="$CustomTool$" Value="CfmlGenerator" />
</CustomParameters>
</TemplateContent>
</VSTemplate>
Note the ReplaceParameters="true" attribute and CustomParameters section (CfmlGenerator is my own IVSSingleFileGenerator). But it does not seem to work (althought I have regenerated all templates and rebuilt the solution), and I don't know why.
I also found a programmatic way of doing it using the IVsEditorFactoryNotify interface, implementing the NotifyItemAdded method, and modifying the EditorFactory.dslddt (or EditorFactory.dslddi). This works great! If some people are interested I may drop a note on how to do it.
Thanks again.