locked
How can I change class name in item template? RRS feed

  • Question

  • Hi,

    I am trying to add item template to my project. I am using template wizard to receive same inputs from developer.

    According to inputs, I can add 1 .. n piece class. I can set class file name but I can't set class name. Because I must set class name according to developer inputs.  I can't define same custom to replacement dictionary because I don't know how many class generated. Every class must have a different name.

    How can I change class name in template?

    Thanks.

    Mehmet

     

    Tuesday, June 22, 2010 8:52 AM

Answers

All replies

  • You can try the following steps:

    1. Create one item template for your class

    2. Create one item template using the template wizard model to gather user input determining the number of classes to be created.

    3. In the "ProjectItemFinishedGenerating" insert code to add each class through the Project.ProjectItems.AddFromTemplate method

    Wednesday, June 23, 2010 1:08 AM
  • How can I insert code to each class ?

    I tried to read and write class file that new created with template. I receive error as file is using another process..

    Mehmet

    Wednesday, June 23, 2010 11:59 AM
    • Proposed as answer by Nancy Shao Friday, June 25, 2010 9:12 AM
    • Marked as answer by Nancy Shao Monday, June 28, 2010 7:16 AM
    Wednesday, June 23, 2010 4:57 PM