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.FindSymb ol('PROJECT_PAT H');
var strProjectName = wizard.FindSymb ol('PROJECT_NAM E');
var strMFCProjectNa me = strProjectName + "MFC";
var strConsoleProje ctName = strProjectName + "Console";
var strResFolder = strProjectPath + "\\res";
var Solution;
Solution = CreateSolution( strProjectName, strProjectPath) ;
//Create MFC project
//wizard.RemoveSy mbol('CON_PRJ') ;
selProj = CreateCustomPro ject(strMFCProj ectName, strProjectPath, Solution);
AddConfig(selPr oj, strMFCProjectNa me);
AddFilters(selP roj);
var oFSO = new ActiveXObject(" Scripting.FileS ystemObject");
if(!oFSO.Folder Exists(strResFo lder))
oFSO.CreateFold er(strResFolder );
var InfFile = CreateCustomInf File();
AddFilesToCusto mProj(selProj, strMFCProjectNa me, strProjectPath, InfFile);
PchSettings(sel Proj);
InfFile.Delete( );
selProj.Object. Save();
wizard.AddSymbo l("CON_PRJ",1,1 );
var strSymbol = "The symbol CON_PRJ is equal to " +
wizard.FindSymb ol("CON_PRJ");
wizard.OkCancel Alert(strSymbol );
//Create Console project
selProj = CreateCustomPro ject(strConsole ProjectName, strProjectPath,
Solution);
AddConfig(selPr oj, strConsoleProje ctName);
AddFilters(selP roj);
InfFile = CreateCustomInf File();
AddFilesToCusto mProj(selProj, strConsoleProje ctName, strProjectPath,
InfFile);
PchSettings(sel Proj);
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.rc 2
res\\rootmfc.ic o
[!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 CreateCustomInf File
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 CreateCustomInf File. Anyone have any suggestions?
Thanks,
tcr