@@ -62,37 +62,19 @@ public static BuildOptions GetBuildOptions(ParseResult parseResult, int degreeOf
62
62
parseResult . GetValue ( TestingPlatformOptions . SolutionOption ) ,
63
63
parseResult . GetValue ( TestingPlatformOptions . DirectoryOption ) ) ;
64
64
65
- BuildProperties buildProperties = new (
66
- parseResult . GetValue ( TestingPlatformOptions . ConfigurationOption ) ,
67
- ResolveRuntimeIdentifier ( parseResult ) ,
68
- parseResult . GetValue ( TestingPlatformOptions . FrameworkOption ) ) ;
69
-
70
65
return new BuildOptions (
71
66
pathOptions ,
72
- buildProperties ,
73
67
parseResult . GetValue ( CommonOptions . NoRestoreOption ) ,
74
68
parseResult . GetValue ( TestingPlatformOptions . NoBuildOption ) ,
75
69
parseResult . HasOption ( CommonOptions . VerbosityOption ) ? parseResult . GetValue ( CommonOptions . VerbosityOption ) : null ,
76
70
degreeOfParallelism ,
77
- parseResult . GetValue ( CommonOptions . PropertiesOption ) ,
71
+ GetGlobalProperties ( [ .. msbuildArgs ] ) ,
78
72
unmatchedTokens ,
79
73
msbuildArgs ) ;
80
74
}
81
75
82
- private static string ResolveRuntimeIdentifier ( ParseResult parseResult )
83
- {
84
- if ( parseResult . HasOption ( CommonOptions . RuntimeOption ) )
85
- {
86
- return parseResult . GetValue ( CommonOptions . RuntimeOption ) ;
87
- }
88
-
89
- if ( ! parseResult . HasOption ( CommonOptions . OperatingSystemOption ) && ! parseResult . HasOption ( CommonOptions . ArchitectureOption ) )
90
- {
91
- return string . Empty ;
92
- }
93
-
94
- return CommonOptions . ResolveRidShorthandOptionsToRuntimeIdentifier ( parseResult . GetValue ( CommonOptions . OperatingSystemOption ) , parseResult . GetValue ( CommonOptions . ArchitectureOption ) ) ;
95
- }
76
+ private static string [ ] ? GetGlobalProperties ( IReadOnlyList < string > args )
77
+ => new CliConfiguration ( new CliCommand ( "dotnet" ) { CommonOptions . PropertiesOption } ) . Parse ( args ) . GetValue ( CommonOptions . PropertiesOption ) ;
96
78
97
79
private static IEnumerable < string > GetBinaryLoggerTokens ( IEnumerable < string > args )
98
80
{
@@ -140,39 +122,16 @@ private static ConcurrentBag<TestModule> GetProjectsProperties(ProjectCollection
140
122
141
123
private static Dictionary < string , string > GetGlobalProperties ( BuildOptions buildOptions )
142
124
{
143
- var globalProperties = new Dictionary < string , string > ( ) ;
144
- var buildProperties = buildOptions . BuildProperties ;
125
+ var globalProperties = new Dictionary < string , string > ( buildOptions . UserSpecifiedProperties . Length ) ;
145
126
146
127
foreach ( var property in buildOptions . UserSpecifiedProperties )
147
128
{
148
129
foreach ( var ( key , value ) in MSBuildPropertyParser . ParseProperties ( property ) )
149
130
{
150
- if ( globalProperties . TryGetValue ( key , out var existingValues ) )
151
- {
152
- globalProperties [ key ] = $ "{ existingValues } ;{ value } ";
153
- }
154
- else
155
- {
156
- globalProperties [ key ] = value ;
157
- }
131
+ globalProperties [ key ] = value ;
158
132
}
159
133
}
160
134
161
- if ( ! string . IsNullOrEmpty ( buildProperties . Configuration ) )
162
- {
163
- globalProperties [ CliConstants . Configuration ] = buildProperties . Configuration ;
164
- }
165
-
166
- if ( ! string . IsNullOrEmpty ( buildProperties . RuntimeIdentifier ) )
167
- {
168
- globalProperties [ CliConstants . RuntimeIdentifier ] = buildProperties . RuntimeIdentifier ;
169
- }
170
-
171
- if ( ! string . IsNullOrEmpty ( buildProperties . TargetFramework ) )
172
- {
173
- globalProperties [ CliConstants . TargetFramework ] = buildProperties . TargetFramework ;
174
- }
175
-
176
135
return globalProperties ;
177
136
}
178
137
}
0 commit comments