forked from libgit2/libgit2sharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateUniqueIdentifierTask.cs
More file actions
36 lines (33 loc) · 1.08 KB
/
GenerateUniqueIdentifierTask.cs
File metadata and controls
36 lines (33 loc) · 1.08 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
using System;
using System.IO;
using System.Text;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
namespace CustomBuildTasks
{
public class GenerateUniqueIdentifierTask : Task
{
public override bool Execute()
{
using (FileStream fs = new FileStream(this.OutputFile, FileMode.Create, FileAccess.Write, FileShare.None))
using (StreamWriter sw = new StreamWriter(fs, Encoding.UTF8))
{
sw.WriteLine("using System;");
sw.WriteLine();
sw.WriteLine("namespace LibGit2Sharp.Core");
sw.WriteLine("{");
sw.WriteLine(" internal static class UniqueId");
sw.WriteLine(" {");
sw.WriteLine(" public const String UniqueIdentifier = \"" + Guid.NewGuid().ToString() + "\";");
sw.WriteLine(" }");
sw.WriteLine("}");
}
return true;
}
public String OutputFile
{
get;
set;
}
}
}