Skip to content

Commit b677335

Browse files
author
Sebastian Nemeth
committed
Fixed bug where projarg parameters in the style of /target: would be parsed as names not values.
1 parent f467854 commit b677335

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

GitVersionExe/ArgumentParser.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ namespace GitVersion
55
using System.Collections.Specialized;
66
using System.Linq;
77
using System.Reflection;
8+
using System.Text.RegularExpressions;
9+
810

9-
1011
public class ArgumentParser
1112
{
1213
static ArgumentParser()
@@ -259,7 +260,8 @@ static NameValueCollection CollectSwitchesAndValuesFromArguments(List<string> na
259260

260261
static bool IsSwitchArgument(string value)
261262
{
262-
return value != null && (value.StartsWith("-") || value.StartsWith("/")) && !value.StartsWith("/p:"); //Exclude msbuild parameters, which should be parsed as values, not switch names.
263+
return value != null && (value.StartsWith("-") || value.StartsWith("/"))
264+
&& !Regex.Match(value, @"/\w+:").Success; //Exclude msbuild & project parameters in form /blah:, which should be parsed as values, not switch names.
263265
}
264266

265267
static bool IsSwitch(string switchName, string value)

0 commit comments

Comments
 (0)