' Visual Basic
' Create a solution folder
Dim projSolFolder As EnvDTE.Project
projSolFolder = soln.AddSolutionFolder("WalkthroughSolutionFolder")
projSolFolder.Globals("ElementType") = "WalkthroughSolutionFolder"
projSolFolder.Globals.VariablePersists("ElementType") = True
' Create a project
Dim templatePath As String
Dim solnFolder As EnvDTE80.SolutionFolder = _
CType(projSolFolder.Object, EnvDTE80.SolutionFolder)
' If you created the WalkthroughTemplate project in C#, then replace
' VisualBasic in the line below with CSharp
templatePath = soln.GetProjectTemplate("WalkthroughTemplate", _
"VisualBasic")
solnFolder.AddFromTemplate(templatePath, projectPath & _
"\WalkthroughTemplate", "WalkthroughTemplate")
Dim projWalkthroughTemplate = _
CType(projSolFolder.ProjectItems.Item(1).Object, EnvDTE.Project)
projWalkthroughTemplate.Globals("ElementType") = _
"WalkthroughTemplate"
projWalkthroughTemplate.Globals.VariablePersists("ElementType") = _
True)
' Set Policy
projSolFolder.Properties.Item("VSPolicyExtenderProvider.TDLFileNAME").Value = _
System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) & "\Microsoft Visual Studio 8\Common7\IDE\Policy\Definitions\WalkthroughPolicy.vspolicy"
// Visual C#
// Create a solution folder
EnvDTE.Project projSolFolder;
projSolFolder = soln.AddSolutionFolder("WalkthroughSolutionFolder");
projSolFolder.Globals["ElementType"] = "WalkthroughSolutionFolder";
projSolFolder.Globals.set_VariablePersists("ElementType", true);
// Create a project
string templatePath;
EnvDTE80.SolutionFolder solnFolder =
(EnvDTE80.SolutionFolder)projSolFolder.Object;
// If you created the WalkthroughTemplate project in Visual Basic, //then replace CSharp in the line below with VisualBasic
templatePath = soln.GetProjectTemplate("WalkthroughTemplate", "CSharp");
solnFolder.AddFromTemplate(templatePath, projectPath +
"\\WalkthroughTemplate", "WalkthroughTemplate");
EnvDTE.Project projWalkthroughTemplate;
projWalkthroughTemplate =
(EnvDTE.Project)projSolFolder.ProjectItems.Item(1).Object;
projWalkthroughTemplate.Globals["ElementType"] =
"WalkthroughTemplate";
projWalkthroughTemplate.Globals.set_VariablePersists("ElementType", true);
// Set Policy
projSolFolder.Properties.Item("VSPolicyExtenderProvider.TDLFileNAME").Value =
System.Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + "\\Microsoft Visual Studio 8\\Common7\\IDE\\Policy\\Definitions\\WalkthroughPolicy.vspolicy"; You have now added a solution folder, a project, and set policy.