How to use T4 code generation templates with VS C++ projects?

前端 未结 4 1989
醉酒成梦
醉酒成梦 2020-12-14 11:34

T4 template files are automatically recognizable by the IDE under C# projects, but I have no clue on how they can be integrated into C++ projects (other than using make file

4条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-14 12:02

    For Visual Studio 2017 (and maybe 2015?)

    The commands listed in the other answers are partly incorrect, as the file TextTransform.exe has been moved to a new directory: the devenv root folder, e.g.:

    C:\Progra~1\Visual Studio 2017\Enterprise\Common7\IDE
    

    The command should now be updated to the following:

    "$(DevEnvDir)TextTransform.exe" -out "$(ProjectDir)xxx.cpp" "$(ProjectDir)xxx.tt"
    

    where xxx is the file name of yout .tt template file

提交回复
热议问题