Sunday 15 February 2015

visual studio 2013 - Trigger code-generation in a VS project template -



visual studio 2013 - Trigger code-generation in a VS project template -

i created project template has sql database , linq2sql dbml file. project created using template not compile due apparent missing code, if right-click on dbml file , invoke run custom tool missing code generated , thereafter compilation succeeds.

what need project template triggers code-generation? i'm aware of iwizard extension scheme project templates, have no thought how programmatically cause ide perform code generation.

so question is: how, in wizard implementation utilize in project template, trigger ide code generation?

one possible method adding pre-build event project runs batch file [transformer.bat] , performs transformation:

get list of files need transformed using next in transformer.bat:

dir %wdir%\*.tt /b /s > myfiles.txt

and run texttransform utility against them similar following:

for /f %%d in (myfiles.txt) ( set file_name=%%d set file_name=!file_name:~0,-3!.%extension% texttransform.exe -out !file_name! %%d )

the key here pre-build event , creating batch file runs texttransform utility.

if more leaned towards msbuild integration need come somehting following:

<propertygroup> <transformonbuild>true</transformonbuild> </propertygroup> .....

in tt files.

transforming templates in build

templates visual-studio-2013

No comments:

Post a Comment