aboutsummaryrefslogtreecommitdiff
path: root/src/WixToolset.BuildTasks/Common.cs
diff options
context:
space:
mode:
Diffstat (limited to 'src/WixToolset.BuildTasks/Common.cs')
-rw-r--r--src/WixToolset.BuildTasks/Common.cs41
1 files changed, 0 insertions, 41 deletions
diff --git a/src/WixToolset.BuildTasks/Common.cs b/src/WixToolset.BuildTasks/Common.cs
deleted file mode 100644
index 803e9d14..00000000
--- a/src/WixToolset.BuildTasks/Common.cs
+++ /dev/null
@@ -1,41 +0,0 @@
1// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
2
3namespace WixToolset
4{
5 using System;
6 using System.Globalization;
7 using System.Text;
8 using System.Text.RegularExpressions;
9
10 /// <summary>
11 /// Common WixTasks utility methods and types.
12 /// </summary>
13 internal static class Common
14 {
15 /// <summary>Metadata key name to turn off harvesting of project references.</summary>
16 public const string DoNotHarvest = "DoNotHarvest";
17
18 private static readonly Regex AddPrefix = new Regex(@"^[^a-zA-Z_]", RegexOptions.Compiled);
19 private static readonly Regex IllegalIdentifierCharacters = new Regex(@"[^A-Za-z0-9_\.]|\.{2,}", RegexOptions.Compiled); // non 'words' and assorted valid characters
20
21 /// <summary>
22 /// Return an identifier based on passed file/directory name
23 /// </summary>
24 /// <param name="name">File/directory name to generate identifer from</param>
25 /// <returns>A version of the name that is a legal identifier.</returns>
26 /// <remarks>This is duplicated from WiX's Common class.</remarks>
27 internal static string GetIdentifierFromName(string name)
28 {
29 string result = IllegalIdentifierCharacters.Replace(name, "_"); // replace illegal characters with "_".
30
31 // MSI identifiers must begin with an alphabetic character or an
32 // underscore. Prefix all other values with an underscore.
33 if (AddPrefix.IsMatch(name))
34 {
35 result = String.Concat("_", result);
36 }
37
38 return result;
39 }
40 }
41}