Currently, I am working on developing a Visual Studio extension for a new C++ project template using Visual Studio 2010. The approach I am taking involves utilizing the .vsz template method and customizing the default.js code to suit my requirements. Within the OnFinish(selProj, selObj) function, I perform tasks such as copying an existing solution from a specific directory on my computer to the current solution directory, adding the newly generated project to the solution, and executing it.
The process looks something like this:
function OnFinish(selProj, selObj) {
try
{
var strProjectPath = wizard.FindSymbol('PROJECT_PATH');
var strProjectName = wizard.FindSymbol('PROJECT_NAME');
selProj = CreateCustomProject(strProjectName, strProjectPath);
AddConfig(selProj, strProjectName);
AddFilters(selProj);
var InfFile = CreateCustomInfFile();
AddFilesToCustomProj(selProj, strProjectName, strProjectPath, InfFile);
PchSettings(selProj);
InfFile.Delete();
selProj.Object.Save();
debugger;
//My Added Code
var strSolutionPath = strProjectPath + "\\..";
var EmulationPath = "C:\\Users\\username\\Desktop\\TestSln";
var TreePath = strSolutionPath + "\\apps";
var fso = new ActiveXObject("Scripting.FileSystemObject");
fso.CopyFolder(EmulationPath, strSolutionPath);
var Solution = dte.Solution;
Solution.Open(strSolutionPath + "\\TestSln.sln");
var p = Solution.AddFromFile(strProjectPath + "\\" + strProjectName + ".vcxproj");
}
catch(e)
{
if (e.description.length != 0)
SetErrorInfo(e);
return e.number
}
}
However, I am facing an issue where I need to add the new project to a specific sub-folder within the solution directory instead of directly to the solution itself. As of now, the above code adds the project directly to the solution, but I would prefer to have it added to the solutionDir\apps folder. This "apps" folder is currently empty, and I aim to populate it with the newly generated project going forward.
If you have any insights or suggestions on how to achieve this, I would greatly appreciate it! Thank you!