-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbuild.xml
More file actions
57 lines (52 loc) · 2.85 KB
/
build.xml
File metadata and controls
57 lines (52 loc) · 2.85 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<project name="WPNotifications" default="setversion" basedir="." xmlns="http://nant.sf.net/release/0.86-beta1/nant.xsd">
<property name="sys.programFiles.x86" value="C:\Program Files (x86)" overwrite="false" />
<property name="sys.vs9.mstest.exe" value="${sys.programFiles.x86}\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" overwrite="false" />
<property name="sys.vs9.fxcopcmd.exe" value="${sys.programFiles.x86}\Microsoft FxCop 1.36\FxCopCmd.exe" overwrite="false" />
<property name="sys.vsBaseDir" value="${sys.programFiles.x86}\Microsoft Visual Studio 10.0\Common7\IDE"/>
<property name="nant.settings.currentframework" value="net-4.0"/>
<property name="configuration" value="release"/>
<property name="ver" value="${CCNetLabel}"/>
<property name="versionAssemblyInfoFile" value="GlobalAssemblyInfo.cs" overwrite="false" />
<target name="setversion" description="Set assembly version">
<echo message="Version is ${ver}"/>
<script language="C#">
<code>
<![CDATA[
public static void ScriptMain(Project project)
{
string ver = project.Properties["ver"];
string fileName = project.Properties["versionAssemblyInfoFile"];
if (!String.IsNullOrEmpty(ver) && !String.IsNullOrEmpty(fileName))
{
//Update assembly info
string content;
string assemblyInfoFile = Path.Combine(project.BaseDirectory, fileName);
using (StreamReader sr = new StreamReader(assemblyInfoFile))
content = sr.ReadToEnd();
content = Regex.Replace(content, @"\[assembly: AssemblyVersion\("".*""\)\]", "[assembly: AssemblyVersion(\"" + ver + "\")]");
content = Regex.Replace(content, @"\[assembly: AssemblyFileVersion\("".*""\)\]", "[assembly: AssemblyFileVersion(\"" + ver + "\")]");
using (StreamWriter sw = new StreamWriter(assemblyInfoFile, false))
sw.Write(content);
//Update installer ver
//string installerVer = "\"ProductVersion\" = \"8:" + ver.Substring(0, ver.LastIndexOf('.')) + '"';
//string guid = Guid.NewGuid().ToString().ToUpper();
//string productVer = "\"ProductCode\" = \"8:{"+guid+"}\"";
//using (StreamReader sr = new StreamReader(installerPpojectFile))
// content = sr.ReadToEnd();
//content = Regex.Replace(content, "\"ProductVersion\" = \"8:[\\d\\.]*\"", installerVer);
//content = Regex.Replace(content, "\"ProductCode\" = \"8:(\\{)\\w{8}\\-\\w{4}\\-\\w{4}\\-\\w{4}\\-\\w{12}(\\})\"", productVer);
//using (StreamWriter sw = new StreamWriter(installerPpojectFile, false))
// sw.Write(content);
}
}
]]>
</code>
<imports>
<import namespace="System.Text.RegularExpressions"/>
</imports>
<references>
<include name="System.dll"/>
</references>
</script>
</target>
</project>