How to modify file when loading from template

Hi, I have a question on creating new Project Type and adding it to VS.
I have created new Project Template and adding it VS using ProjectSubtype.
And actually new project templates is shown on VS and I can choose it to
create new project.

However, when loading files from template, I want to modify those files.
For example, changing name of class, etc.

I know how to do this if I create new project type by extending ProjectNode.
In this case, I can just override AddFilesFromTemplate methods.
But I don't know how to do this in ProjectSubtype. Can I do it by overriding some
functios Or do I need to implement some interface to do this If so, would someone tell me which interface to implement

Thanks,

Ryo


Answer this question

How to modify file when loading from template

  • Michael Kang

    If you are using the new VSTemplate Wizard, then there are a number of replacement varibles that you can sprinkle throughout your code that are automatically replaced when the wizard runs. For example, you can place the value $safeprojectname$ into a template, and when the wizard runs it will replace this value with the project name modified to be used safely as an identifier (for example, a project named "My Project" will become My_Project).

    The best way for you to create a template is to select File | Export Template. This tool will generate a template with replacement variables, package it into a .zip, and copy the .zip into the right place so that it will show up in the New Project/Add New Item dialog boxes.

    Craig

  • JVman

    One other thing, if you need to extend the wizard to add your own replacement variables or further modify the template, there is an interface named IWizard that you can implement that will allow you to hook yourself into the wizard. There is documentation in MSDN on how to use this interface.

    Craig

  • How to modify file when loading from template