Hi,
Not sure if this is the correct group so let me know. I am attempting to
create a new custom app wizard that will output one solution that contains
two projects. One is an MFC project and the other is a console. In the
OnFinish function of the default.js file, I create the one solution and then
cycle through the code twice to create the projects. Here is the code:
var strProjectPath = wizard.FindSymbol('PROJECT_PATH');
var strProjectName = wizard.FindSymbol('PROJECT_NAME');
var strMFCProjectName = strProjectName + "MFC";
var strConsoleProjectName = strProjectName + "Console";
var strResFolder = strProjectPath + "\\res";
var Solution;
Solution = CreateSolution(strProjectName,strProjectPath);
//Create MFC project
//wizard.RemoveSymbol('CON_PRJ');
selProj = CreateCustomProject(strMFCProjectName, strProjectPath, Solution);
AddConfig(selProj, strMFCProjectName);
AddFilters(selProj);
var oFSO = new ActiveXObject("Scripting.FileSystemObject");
if(!oFSO.FolderExists(strResFolder))
oFSO.CreateFolder(strResFolder);
var InfFile = CreateCustomInfFile();
AddFilesToCustomProj(selProj, strMFCProjectName, strProjectPath, InfFile);
PchSettings(selProj);
InfFile.Delete();
selProj.Object.Save();
wizard.AddSymbol("CON_PRJ",1,1);
var strSymbol = "The symbol CON_PRJ is equal to " +
wizard.FindSymbol("CON_PRJ");
wizard.OkCancelAlert(strSymbol);
//Create Console project
selProj = CreateCustomProject(strConsoleProjectName, strProjectPath,
Solution);
AddConfig(selProj, strConsoleProjectName);
AddFilters(selProj);
InfFile = CreateCustomInfFile();
AddFilesToCustomProj(selProj, strConsoleProjectName, strProjectPath,
InfFile);
PchSettings(selProj);
InfFile.Delete();
selProj.Object.Save();
I'm trying to use the symbol 'CON_PRJ' in the Templates.inf file so that
it will add the appropriate. Here is the contents of that file:
TestClass.h
TestClass.cpp
stdafx.h
stdafx.cpp
[!if CON_PRJ == 1]
rootConsole.cpp
[!else]
rootmfc.h
rootmfc.cpp
resource.h
rootmfc.rc
res\\rootmfc.rc2
res\\rootmfc.ico
[!endif]
You will notice that I add the symbol before creating the console
project and then output its value for debugging purposes. The problem is
that if I define it after a call to RenderTemplate in the CreateCustomInfFile
function it indicates that the symbol is undefined. If I define it before,
it remains defined. This means that the projects are created from two
template files that are exactly the same. I can't update the symbol table
after the first call to CreateCustomInfFile. Anyone have any suggestions?
Thanks,
tcr