locked
Item Template question. How to set T4 template output as content of ProjectItem? RRS feed

  • Question

  • How can the project item output of an Item Template be set to the output of a T4 template?

    I have a Visual Studio Item Template project.  Then added a VSIX project with a class that implements the IWizard interface. In the RunStarted method I prompt for parameters. Then run ITextTemplating.ProcessTemplate. How to set the output of ProcessTemplate to be the contents of the ProjectItem of the Item Template?

    thanks,


    • Moved by Weiwei Cai Thursday, May 26, 2016 3:14 AM more related to VS Integrate
    Wednesday, May 25, 2016 1:21 PM

Answers

  • Hi Steve Richter,

    >>"How to set the output of ProcessTemplate to be the contents of the ProjectItem of the Item Template?"

    You could output the files to the folder of project. Then you could add these files as project items to project using AddFromFile method. Code below is for your reference.

    project.ProjectItems.AddFromFile(fileFullName);
    

    For more information, link below is for your reference.
    http://www.mztools.com/articles/2014/MZ2014009.aspx

    Best Regards,
    Li Wang

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Steve Richter Thursday, May 26, 2016 10:29 AM
    • Unmarked as answer by Steve Richter Thursday, May 26, 2016 11:48 AM
    • Marked as answer by Steve Richter Friday, May 27, 2016 8:30 PM
    Thursday, May 26, 2016 7:39 AM

All replies

  • Hi Steve Richter,

    This forum is discuss Visual Studio WPF/SL Designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System, and Visual Studio Editor.

    Since your problem is more related to Visual Studio Integrate, I help you move this thread to Visual Studio Integrate forum for a better help. Thanks for your understanding.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, May 26, 2016 3:14 AM
  • Hi Steve Richter,

    >>"How to set the output of ProcessTemplate to be the contents of the ProjectItem of the Item Template?"

    You could output the files to the folder of project. Then you could add these files as project items to project using AddFromFile method. Code below is for your reference.

    project.ProjectItems.AddFromFile(fileFullName);
    

    For more information, link below is for your reference.
    http://www.mztools.com/articles/2014/MZ2014009.aspx

    Best Regards,
    Li Wang

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Steve Richter Thursday, May 26, 2016 10:29 AM
    • Unmarked as answer by Steve Richter Thursday, May 26, 2016 11:48 AM
    • Marked as answer by Steve Richter Friday, May 27, 2016 8:30 PM
    Thursday, May 26, 2016 7:39 AM
  • Hi Steve Richter,

    >>"How to set the output of ProcessTemplate to be the contents of the ProjectItem of the Item Template?"

    You could output the files to the folder of project. Then you could add these files as project items to project using AddFromFile method. Code below is for your reference.

    project.ProjectItems.AddFromFile(fileFullName);
    

    For more information, link below is for your reference.
    http://www.mztools.com/articles/2014/MZ2014009.aspx


    is project.ProjectItems.AddFromFile used within the context of the ItemTemplate project?  Or should I scrap the ItemTemplate project and the IWizard implementation and write a standalone add-in?

    thanks,

    Thursday, May 26, 2016 11:52 AM