-
Notifications
You must be signed in to change notification settings - Fork 3
/
AssemblyInfoersion.t4
43 lines (36 loc) · 1.46 KB
/
AssemblyInfoersion.t4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<#@ template language="vb" hostSpecific="True"#>
<#@ output extension="vb" #>
<#@ import namespace="System.IO" #>
<#
dim revisionNumber as integer
dim time as DateTime = DateTime.now
Dim format As String = "MMdd"
Dim YearFormat as string = "yyyy"
Dim CurrentYear as string = time.ToString(YearFormat)
dim CurrentDate as string = time.ToString(format)
try
'If we cannot find the file, the revision number is set to zero,
'so even if the file doesn't exists the generation will run anyway.
'NOTE: we suppose we're not messing with the generated file
using f as new StreamReader (Host.ResolvePath("AssemblyInfoersion.vb"))
'We're reading the previous revision number; in order to make the
'code as simple as we can, we're just going to rewrite it on the first row, commented.
'This is not elegant, but it's simple enough and quite effective.
dim s as string = f.ReadLine().Replace("'","")
integer.tryParse(s, revisionNumber)
#IF DEBUG THEN
#ELSE
revisionNumber += 1
#END IF
end using
catch e as exception
revisionNumber = 0
end try
#>
'<#=revisionNumber#>
''
' This code was generated by a tool. Any changes made manually will be lost
' the next time this code is regenerated.
''
Imports System.Reflection
<Assembly: AssemblyInformationalVersion("2.19.PreAlpha <#= revisionNumber.ToString() #>")>