Pergunta

For the life of me, I can't get my DSL project to be exported as a template, other than the default ItemTemplate (as in Add New Item)

Does anyone happen to have a summary of what has to be done to be able to create a new project? VSTemplate follows. Have tried adding the zip to the VSIX as Content (ProjTemplate) to no avail.

<!--DSL Tools Language Template-->
<VSTemplate Version="3.0.0" Type="Item" xmlns="http://schemas.microsoft.com/developer/vstemplate/2005" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <TemplateData>
        <Name Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="103"/>
        <Description Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="102"/>
        <Icon Package="{602c1894-d640-407a-a311-aca9d5ab7a5c}" ID="201" />
        <ProjectType>CSharp</ProjectType>
        <SortOrder>360</SortOrder>
        <DefaultName>FlowDsl.mhf</DefaultName>
    </TemplateData>
    <TemplateContent>
        <ProjectItem TargetFileName="$fileinputname$.mhf">mhf.mhf</ProjectItem>
        <ProjectItem TargetFileName="$fileinputname$.mhf.diagram">mhf.diagram</ProjectItem>
    </TemplateContent>
</VSTemplate>

Thanks;

Foi útil?

Solução

It sounds like you want a project template, correct? For starters, the Type attribute on the VSTemplate element should be Type="Project" instead of Type="Item". Additionally, project templates need to have a <Project> element (usually a csproj/vbproj file) in the <TemplateContent> to use as a starter project.

I would suggest creating a C# or VB project with an instance of your DSL as a project item (and structuring the project as you would want your template). Then, try using the Export Template Wizard to create a VSIX with your project template.

If you want to further customize and control what is in the template, check out this blog post which describes how to manually author and package your templates.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top