Trasabilitatea in software–partea a doua–adaugarea build date

Ne propunem mai intii sa putem punem automat build date in AssemblyVersion. Pentru aceasta va trebui cumva sa generam data curenta .

O putem face in mai multe feluri – de exemplu , un post build event. Vom folosi insa un fisier .tt care ne va genera automat acest data . Il vom folosi si pentru alte lucruri – de exemplu , pentru ultimul checkin de tfs.

Pentru rularea fisierelor .tt putem folosi fie comanda Build=> Transform all T4 templates, fie solutia de aici (Run .tt files on each build

http://stackoverflow.com/questions/1646580/get-visual-studio-to-run-a-t4-template-on-every-build

)

Proiectul demo il puteti download de aici

Propriul pre-build este acesta ( inspirat de http://stackoverflow.com/questions/1646580/get-visual-studio-to-run-a-t4-template-on-every-build )

@echo on

SETLOCAL ENABLEDELAYEDEXPANSION

echo set the file extension

set extension=cs

echo create a list of all the T4 templates in the working dir

dir $(ProjectDir)\*.tt /b /s > t4list.txt

echo the following T4 templates will be transformed:

type t4list.txt

echo transform all the templates

for /f %%d in (t4list.txt) do (

set file_name=%%d

set file_name=!file_name:~0,-3!.%extension%

echo: \–^> !file_name!

“%CommonProgramFiles(x86)%\Microsoft Shared\TextTemplating\12.0\TextTransform.exe” -out !file_name! %%d

)

echo transformation complete

Video : https://www.youtube.com/watch?v=lZJ1NCIDejU

Proiectul demo il puteti downloada de aici : https://traceabilitydemo.codeplex.com/releases/view/132229

Codul sursa il puteti downloada de aici: https://traceabilitydemo.codeplex.com/SourceControl/changeset/view/110438

Data viitoare vom adauga id-ul checkin-ului de TFS.