Templates c# code not added

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I made a template for webforms. The template.inf calls for two files the
..ascx and the .cs. The .cs template file's code does not get written out to
the newly added control?

Joe
 
Hello Joe,

Thanks for your post. As I understand, you create a template for webforms.
It adds the .ascx file without the codehide .cs file. Please correct me if
there is any misunderstanding. I'd like to share the following information
with you:

It seems to me that the template is similar to CSharpAddWebControl wizard.
The easiest way to proceed is to inspect the existing CSharpAddWebControl
wizard which consists of the following files:

1. Under "Program Files\Microsoft Visual Studio .NET
2003\VC#\VC#Wizards\CSharpAddWebUserControl", there are a template file
(WebUserControl.ascx), a list of templates (template.inf) and a script file
that drives the customization (default.js).

2. The code behind template NewWebUserControlCode.cs is put at "Program
Files\Microsoft Visual Studio .NET 2003\VC#\DesignerTemplates\1033"

3. A CSharpAddWebUserControl.vsz file which describes the wizard is placed
at "Program Files\Microsoft Visual Studio .NET
2003\VC#\CSharpProjectItems". Check
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxconvszfiles.asp for a description of the format.

4. There are entries for CSharpAddWebUserControl.vsz in .vsdir files that
contains human readable information about your wizard. The files are
located at the "Program Files\Microsoft Visual Studio .NET
2003\VC#\CSharpProjectItems\WebProjectItems" folder. Check
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/ht
ml/vxconvsdirfiles.asp for a description of the .vsdir format.

You can make a copy of this wizard, rename it, add a corresponding vsz and
vsdir files and then customize the template and script files to suit your
needs. In addition, I believe the following article is also helpful:

Tutorial: Creating Custom Project Template Wizards Using C# and .NET
http://www.c-sharpcorner.com/Code/2003/Nov/CustomWizard.asp

Please feel free to let me know if you have any problems or concerns.

Regards,

HuangTM
Microsoft Online Partner Support
MCSE/MCSD

Get Secure! -- www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top