This step-by-step article describes how to migrate a Microsoft Visual C++ 6.0 custom AppWizard to a Microsoft Visual C++ .NET custom wizard. The custom wizard technology in Visual C++ .NET is significantly different from the custom AppWizard technology in Visual C++ 6.0. You cannot port a custom AppWizard project that was created in Visual C++ 6.0 directly to the new technology. However, you can reuse the existing template files and modify the existing directives to the new syntax.
Copy the template files to
the template directories
In the Workspace window, click the FileView tab, right-click Template Files, and then click Add Files to Folder.
The Insert Files into Project dialog box appears.
In the Insert Files into Project dialog box, locate the following folder: Path_to_VC6_Custom _AppWizard\MyVC6Custom\Template
Add the Root.cpp file, the SAfx.cpp file, and the SAfx.h file to the Template Files folder.
In the Template Files folder, right-click Confirm.inf, click Open, and then replace the existing text in the Confirm.inf file with the following text:
Simple Win32 console application. Prints "Hello, World!" to the console.
In the Template Files folder, right-click Newproj.inf, click Open, and then replace the existing code in the Newproj.inf file with the following code:
$$// newproj.inf = template for list of template files
$$// format is 'sourceResName' \t 'destFileName'
$$// The source res name may be preceded by any combination of '=', '-', '!', '?', ':', '#', and/or '*'.
$$// '=' => the resource is binary
$$// '-' => the file should not be added to the project (all files are added to the project by default)
$$// '!' => the file should be marked exclude from build
$$// '?' => the file should be treated as a Help file
$$// ':' => the file should be treated as a resource
$$// '#' => the file should be treated as a template (implies '!')
$$// '*' => bypass the custom AppWizard's resources when loading
$$// if name starts with / => create new subdir
+root.cpp $$Root$$.cpp
+SAfx.h StdAfx.h
+SAfx.cpp StdAfx.cpp
Note You must separate the file names by using the TAB key. Do not use the SPACEBAR.
In the workspace, click the ResourceView tab, expand MyVC6Custom resources, right-click TEMPLATE, and then click Insert.
The Insert Resource dialog box appears.
In the Insert Resource dialog box, click Import.
The Import Resource dialog box appears.
In the Files of type box, click All Files (*.*), and then locate the following folder: Path_to_VC6_Custom _AppWizard\MyVC6Custom\Template
Click Root.cpp, and then click Import.
The Custom Resource Type dialog box appears.
In the Custom Resource Type dialog box, click TEMPLATE, and then click OK.
The IDR_TEMPLATE1 template is added to the TEMPLATE folder.
Right-click IDR_TEMPLATE1, click Properties, type "ROOT.CPP" in the ID box, and then press ENTER.
Repeat step 11 to add the SAfx.h file and the SAfx.cpp file to the TEMPLATE folder, and rename their ID properties to "SAFX.H" and "SAFX.CPP", respectively.
On the File menu, click Save All.
On the Build menu, click Rebuild All.
The MyVC6Custom AppWizard custom AppWizard is created. The MyVC6Custom AppWizard template is added to the Visual C++ Projects tab.
Locate the following folder: Path_to_VC7_Custom _Wizard\MyVC7Custom
Copy the MyVC7Custom.ico file, the MyVC7Custom.vsz file, and the MyVC7Custom.vsdir file to the following location: Hard disk drive\Microsoft Visual Studio .NET 2003\Vc7\vcprojects folder. Hard disk drive is a placeholder for the drive where Visual Studio .NET 2003 is installed.
Note If you created the custom wizard in Microsoft Visual Studio .NET 2002, copy the MyVC7Custom.ico file, the MyVC7Custom.vsz file, and the MyVC7Custom.vsdir file to the following location: Hard disk drive\Microsoft Visual Studio .NET\Vc7\vcprojects folder. Hard disk drive is a placeholder for the drive where Visual Studio .NET 2002 is installed.
The MyVC7Custom custom wizard template is created. You can use the template to create a simple Win32 console application.
The VSZ file The starting point for each wizard in Visual Studio .NET is the .vsz file. This .vsz file is a text file that determines what the wizard is named and what information is passed to the wizard. The file contains a two-line header followed by optional parameters that are passed to the wizard.
The VSDir file A VSDir file is a text file with a .vsdir file name extension. The file provides information to the Add Item dialog box and the New Project dialog box about how to display the items that the file contains. These items include their names, the order that they appear, and the icon that is displayed with them. A single VSDir file contains records for multiple wizards, folders, and templates. Each record in the file is separated by a new line character. Pipe (|) characters separate the fields in each record.
The JScript file Every custom wizard creates a JScript file that is named Default.js for each project. This file contains functions that you can use to customize your project. You can also add your own functions to the Default.js file for your project.
The Templates.inf file The Templates.inf file is a text file that contains a list of templates for your project. You can use the template directives in the Templates.inf file to customize your project. Remember the following information when you use the template directives:
You cannot nest an [!if] directive in a [!loop] directive.
You can nest a [!loop] directive in another [!loop] directive or in [!if]/[!else] directives.
There is no [!elif] directive. You cannot nest [!if] directives in [!if]/[!else] directives. So for $$ELIF directives, you must duplicate the logic. For example, the following code is an example of an IF-ELSE loop that is created by using Visual C++ 6.0 template directives:
$$IF (macro1) // Some code 1 $$ELIF (macro2) // Some code 2 $$ENDIF
This code can be converted to the following code according to Visual C++ .NET template directives:
[!if macro1] // Some code 1 [!endif] [!if !macro1 and macro2] // Some code 2 [!endif]
You can specify comments by using the following example: