@@ -68,7 +68,7 @@ private static int ForwardToMsbuild(ParseResult parseResult, string[] args, stri
68
68
try
69
69
{
70
70
Environment . SetEnvironmentVariable ( NodeWindowEnvironmentName , "1" ) ;
71
- int exitCode = FromParseResult ( parseResult , args , settings , testSessionCorrelationId ) . Execute ( ) ;
71
+ int exitCode = FromParseResult ( parseResult , settings , testSessionCorrelationId ) . Execute ( ) ;
72
72
73
73
// We run post processing also if execution is failed for possible partial successful result to post process.
74
74
exitCode |= RunArtifactPostProcessingIfNeeded ( testSessionCorrelationId , parseResult , FeatureFlag . Instance ) ;
@@ -108,7 +108,7 @@ private static int ForwardToVSTestConsole(ParseResult parseResult, string[] args
108
108
return exitCode ;
109
109
}
110
110
111
- private static TestCommand FromParseResult ( ParseResult result , string [ ] args , string [ ] settings , string testSessionCorrelationId , string msbuildPath = null )
111
+ private static TestCommand FromParseResult ( ParseResult result , string [ ] settings , string testSessionCorrelationId , string msbuildPath = null )
112
112
{
113
113
result . ShowHelpOrErrorIfAppropriate ( ) ;
114
114
@@ -119,6 +119,9 @@ private static TestCommand FromParseResult(ParseResult result, string[] args, st
119
119
"-nologo"
120
120
} ;
121
121
122
+ // Extra msbuild properties won't be parsed and so end up in the UnmatchedTokens list. In addition to those
123
+ // properties, all the test settings properties are also considered as unmatched but we don't want to forward
124
+ // these as-is to msbuild. So we filter out the test settings properties from the unmatched tokens.
122
125
var unMatchedNonSettingsArgs = settings . Length > 1
123
126
? result . UnmatchedTokens . TakeWhile ( x => x != settings [ 1 ] )
124
127
: result . UnmatchedTokens ;
@@ -132,30 +135,12 @@ private static TestCommand FromParseResult(ParseResult result, string[] args, st
132
135
133
136
if ( settings . Any ( ) )
134
137
{
135
- //workaround for correct -- logic
136
- //var commandArgument = result.GetValueForArgument(TestCommandParser.SlnOrProjectArgument);
137
- //// TODO: @baronfel, @Evangelink
138
- //// If the project or solution is not specified we would expect null here but we actually
139
- //// get some of the parameter (last one before --) instead.
140
- //if (!string.IsNullOrWhiteSpace(commandArgument) && !settings.Contains(commandArgument))
141
- //{
142
- // msbuildArgs.Add(commandArgument);
143
- //}
144
-
145
138
// skip '--' and escape every \ to be \\ and every " to be \" to survive the next hop
146
139
string [ ] escaped = settings . Skip ( 1 ) . Select ( s => s . Replace ( "\\ " , "\\ \\ " ) . Replace ( "\" " , "\\ \" " ) ) . ToArray ( ) ;
147
140
148
141
string runSettingsArg = string . Join ( ";" , escaped ) ;
149
142
msbuildArgs . Add ( $ "-property:VSTestCLIRunSettings=\" { runSettingsArg } \" ") ;
150
143
}
151
- else
152
- {
153
- //var argument = result.GetValueForArgument(TestCommandParser.SlnOrProjectArgument);
154
- //if (!string.IsNullOrWhiteSpace(argument))
155
- //{
156
- // msbuildArgs.Add(argument);
157
- //}
158
- }
159
144
160
145
string verbosityArg = result . ForwardedOptionValues < IReadOnlyCollection < string > > ( TestCommandParser . GetCommand ( ) , "verbosity" ) ? . SingleOrDefault ( ) ?? null ;
161
146
if ( verbosityArg != null )
0 commit comments