How do I add a child folder to a solution folder? RRS feed

  • Question

  • We are using DevStudio 2008 and I have a stand-alone app that builds a cut-down version of our project.  At one point during the process, I add a solution folder to the solution to hold the ini entries.  I want to create sub folders underneath that folder.  Here is my sample code:

    Solution OrigSol = System.Activator.CreateInstance(Type.GetTypeFromProgID("VisualStudio.Solution")) as EnvDTE.Solution;
    Solution2 Sol = OrigSol as Solution2;
    Sol.Create(SolutionPath, SOLUTION_NAME);

    Project IniFolder = Sol.AddSolutionFolder("Inis");

    string DirName = Path.GetFileNameWithoutExtension(Dir);
    ProjectItem IniSubFolder = IniFolder.ProjectItems.AddFolder(DirName,EnvDTE.Constants.vsProjectItemKindVirtualFolder);

    The call to AddFolder fails saying not implemented.  I've also tried using vsProjectItemKindPhysicalFolder and vsProjectITemKindMisc.  All 3 fail.

    How do I add a child folder to Inis?  Thanks.


    Thursday, January 6, 2011 8:56 PM