4

I have created a multi project Visual Studio Temploate following these instructions: http://msdn.microsoft.com/en-us/library/ms185308.aspx.

This works fine and I can see my two projects in Visual Studio when I select my project template from the File-->New Project option.

enter image description here

Now I want to add another two projects but I now want the projects to appear under different folders like so:

enter image description here

How can I modify the .vstemplate file to make the solution folders appear? I see from this link Add solution folder to visual studio project template that I should use a Wizard (http://msdn.microsoft.com/en-us/library/ms185301.aspx) but I really dont know how to use this to simply create two folders. All help is appreciated.

EDIT I have followed this example http://msdn.microsoft.com/en-us/library/ms185301.aspx and I can now add folders to my project by doing this:

 _DTE _dte;
 Solution2 _solution;

public void RunStarted(object automationObject, Dictionary<string, string> replacementsDictionary, WizardRunKind runKind, object[] customParams)
    {     
        _dte = automationObject as _DTE;
    }

public void RunFinished()
    {
        _solution = (Solution2)_dte.Solution;

        _solution.AddSolutionFolder("MyFolder1");
        _solution.AddSolutionFolder("MyFolder2");    
    }

But what I want to do is add my projects under the folders. They are just appearing on top at present. How do I do this?

Community
  • 1
  • 1
Harry Boy
  • 4,159
  • 17
  • 71
  • 122

1 Answers1

5

programmatically, no! I´ve not do it ... only changing the .vstemplate file

<SolutionFolder Name="Math Classes">
            <ProjectTemplateLink ProjectName="MyFolder1">
                3rdpartyProj\MyTemplate.vstemplate
            </ProjectTemplateLink>
            <ProjectTemplateLink ProjectName="MyFolder2">
                3rdpartyProj\MyTemplate.vstemplate
            </ProjectTemplateLink>
        </SolutionFolder>

SolutionFolder

I think this is what you are looking for?

ger
  • 414
  • 1
  • 4
  • 22