none
VS2017 & T4 Templates

    Question

  • We have upgraded our dot net core project from VS 2015 to Vs 2017 project, 2017 doesn't regenerate any of our T4 template files on save, or build anymore.

    Does anyone know how to fix this?

    Thanks

    Owen

    Thursday, March 16, 2017 4:08 PM

All replies

  • Hi Owen Ashcroft,

    Thanks for posting here.

    It`s very grateful for you finding this issue. I created a dot net project and add a T4 template on Visual Studio 2015, then open it from Visual Studio 2017. I have encountered your problem, the structure of T4 template has been destroyed, doesn't regenerate any of our T4 template files on save. That should be a upgrade issue for Visual Studio.

    Besides, If the project is a common project not .dot net, the T4 template would not be loaded by default after upgrade project to Visual Studio 2017.

    To resolve this issue, you can create a new T4 template on Visual Studio 2017, then copy the code in the previous template, the new template will works fine. 

    In addition, I help you submit this issue to the Visual Studio Developer Community (Thanks for your contribution), you can follow with your comments and check the feedback of this issue. I will also follow up this issue, I will send you the latest status of this issue.

    https://developercommunity.visualstudio.com/content/problem/31678/t4-template-files-does-work-after-update-project-f.html

    Hope this can help you.


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 17, 2017 8:45 AM
  • Does anyone know how to fix this?

    -----

    Create a new project in old Studio, add a single template, save all and exit from Studio.

    Create a new project in new studio, add a single  template, save all and exit from Studio.

    Use WinDiff (or something similar) to figure out a differences in projects,

    Copy old project and convert it into newest version,

    Compare two newest version - most likely you loose something on migration. 

    Simplest option will be to wait for a fix from microsoft, but if you decide to fix it by your self - use an XSLT for transformation.

    Tuesday, April 11, 2017 2:00 PM