Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > How can i add a project in existed Solutionfolder??
 

How can i add a project in existed Solutionfolder??

I created a Solution project.

This solution have two SolutionFolders.


SolutionFolder' s each name is "Service","Main"
and they have own aproject

i added a project in a solutionFolder,it's name "service".

but aerror occured.

errormessage 'duplicated solutionfolder'

my recipe action is like this

EnvDTE.DTE dte = this.GetService<EnvDTE.DTE>(true);

Solution2 soln = (Solution2)dte.Solution;

Project prj;
SolutionFolder SF ;

prj = soln.AddSolutionFolder("Service"); // error duplicatedsolutionfolder

SF = (SolutionFolder)prj.Object;


SF.AddFromTemplate(templateFile, destination, strProjectName);

moleee  Tuesday, May 13, 2008 11:32 AM

EnvDTE.DTE dte = this.GetService<EnvDTE.DTE>(true);

Solution2 soln = (Solution2)dte.Solution;

SolutionFoldersf ;

foreach (Project proj in soln.Projects)
{
System.Windows.Forms.MessageBox.Show(proj.Kind, " proj.Kind ");

System.Windows.Forms.MessageBox.Show(proj.Name, " proj.Name ");

if (proj.Kind == ProjectKinds.vsProjectKindSolutionFolder && proj.Name == "Service" )
{

sf = (SolutionFolder)proj.Object;
sf .AddFromTemplate(templateFile, destination, strProjectName);
break;
}
}

moleee  Tuesday, May 13, 2008 11:30 PM
Hi,

I'm not sure if i understood well, you already have create two solution folder, then you try to run the above code? If it's the case to find out your already created solution folder, you can use the DteHelper.FindProjectByName for example, but you can't call again the AddSolutionFolder. Let me know if it that was you tried to do.

hth.
jose.

Jose Escrich  Friday, May 16, 2008 5:09 PM

EnvDTE.DTE dte = this.GetService<EnvDTE.DTE>(true);

Solution2 soln = (Solution2)dte.Solution;

SolutionFoldersf ;

foreach (Project proj in soln.Projects)
{
System.Windows.Forms.MessageBox.Show(proj.Kind, " proj.Kind ");

System.Windows.Forms.MessageBox.Show(proj.Name, " proj.Name ");

if (proj.Kind == ProjectKinds.vsProjectKindSolutionFolder && proj.Name == "Service" )
{

sf = (SolutionFolder)proj.Object;
sf .AddFromTemplate(templateFile, destination, strProjectName);
break;
}
}

moleee  Tuesday, May 13, 2008 11:30 PM
Hi,

I'm not sure if i understood well, you already have create two solution folder, then you try to run the above code? If it's the case to find out your already created solution folder, you can use the DteHelper.FindProjectByName for example, but you can't call again the AddSolutionFolder. Let me know if it that was you tried to do.

hth.
jose.

Jose Escrich  Friday, May 16, 2008 5:09 PM

You can use google to search for other answers

Custom Search

More Threads

• Add .CS file to a Project
• Install Error for Guidance Automation Extensions - February 2008 Release
• Is .Net Framework 3.0 needed to use Enterprise library 3.1 may 2007
• How to pass parameters to T4 templates using GAX?
• Creating a Recipe for updating a config file
• MSI Installer Report
• Can't download GAT, GAX?
• What makes guidance package show up in "New Project" dialog box?
• Access Denied error on Install of Feb GAT
• Input arguments for wizards