@@ -12,10 +12,14 @@ Copyright (c) .NET Foundation. All rights reserved.
12
12
<Project xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
13
13
<!-- Load Microsoft.TestPlatform.Build.Tasks.dll, this can be overridden to use a different version with $(VSTestTaskAssemblyFile) -->
14
14
<PropertyGroup >
15
- <VSTestTaskAssemblyFile Condition =" $(VSTestTaskAssemblyFile) == ''" >Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile >
16
- <VSTestConsolePath Condition =" $(VSTestConsolePath) == ''" >$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),"vstest.console.dll"))</VSTestConsolePath >
15
+ <VSTestTaskAssemblyFile Condition =" '$(VSTestTaskAssemblyFile)' == ''" >Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile >
16
+ <VSTestConsolePath Condition =" '$(VSTestConsolePath)' == ''" >$([System.IO.Path]::Combine($(MSBuildThisFileDirectory),"vstest.console.dll"))</VSTestConsolePath >
17
+ <VSTestUseConsole Condition =" '$(VSTestUseConsole)' == ''" >False</VSTestUseConsole >
18
+ <VSTestNoBuild Condition =" '$(VSTestNoBuild)' == ''" >False</VSTestNoBuild >
19
+ <_VSTestMSBuildDependsOn Condition =" $(_VSTestMSBuildDependsOn) == '' And !$(VSTestNoBuild)" >$(MSBuildProjectDefaultTargets)</_VSTestMSBuildDependsOn >
17
20
</PropertyGroup >
18
21
<UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
22
+ <UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
19
23
<UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
20
24
21
25
<!--
@@ -24,12 +28,61 @@ Copyright (c) .NET Foundation. All rights reserved.
24
28
Main entry point for running tests through vstest.console.exe
25
29
============================================================
26
30
-->
27
- <Target Name =" VSTest" DependsOnTargets =" ShowInfoMessageIfProjectHasNoIsTestProjectProperty" >
31
+ <Target
32
+ Name =" VSTest"
33
+ DependsOnTargets =" ShowInfoMessageIfProjectHasNoIsTestProjectProperty"
34
+ >
35
+ <!-- Unloggable but colorized output (cf. https://github.com/microsoft/vstest/issues/680) -->
36
+ <CallTarget Targets =" _VSTestConsole" Condition =" $(VSTestUseConsole)" />
37
+ <!-- Proper MSBuild integration, but no custom colorization -->
38
+ <CallTarget Targets =" _VSTestMSBuild" Condition =" !$(VSTestUseConsole)" />
39
+ </Target >
40
+
41
+ <!-- Used when called from dotnet msbuild command line: uses MSBuild logs but does not allow for console colorization -->
42
+ <Target
43
+ Name =" _VSTestMSBuild"
44
+ DependsOnTargets =" $(_VSTestMSBuildDependsOn)"
45
+ Condition =" '$(IsTestProject)' == 'true'"
46
+ >
47
+ <Microsoft .TestPlatform.Build.Tasks.VSTestTask
48
+ TestFileFullPath =" $(TargetPath)"
49
+ VSTestSetting =" $([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
50
+ VSTestTestAdapterPath =" $(VSTestTestAdapterPath)"
51
+ VSTestFramework =" $(TargetFrameworkMoniker)"
52
+ VSTestPlatform =" $(PlatformTarget)"
53
+ VSTestTestCaseFilter =" $(VSTestTestCaseFilter)"
54
+ VSTestLogger =" $(VSTestLogger)"
55
+ VSTestListTests =" $(VSTestListTests)"
56
+ VSTestDiag =" $(VSTestDiag)"
57
+ VSTestCLIRunSettings =" $(VSTestCLIRunSettings)"
58
+ VSTestConsolePath =" $(VSTestConsolePath)"
59
+ VSTestResultsDirectory =" $(VSTestResultsDirectory)"
60
+ VSTestVerbosity =" $(VSTestVerbosity)"
61
+ VSTestCollect =" $(VSTestCollect)"
62
+ VSTestBlame =" $(VSTestBlame)"
63
+ VSTestBlameCrash =" $(VSTestBlameCrash)"
64
+ VSTestBlameCrashDumpType =" $(VSTestBlameCrashDumpType)"
65
+ VSTestBlameCrashCollectAlways =" $(VSTestBlameCrashCollectAlways)"
66
+ VSTestBlameHang =" $(VSTestBlameHang)"
67
+ VSTestBlameHangDumpType =" $(VSTestBlameHangDumpType)"
68
+ VSTestBlameHangTimeout =" $(VSTestBlameHangTimeout)"
69
+ VSTestTraceDataCollectorDirectoryPath =" $(TraceDataCollectorDirectoryPath)"
70
+ VSTestArtifactsProcessingMode =" $(VSTestArtifactsProcessingMode)"
71
+ VSTestSessionCorrelationId =" $(VSTestSessionCorrelationId)"
72
+ VSTestNoLogo =" $(VSTestNoLogo)"
73
+ />
74
+ </Target >
75
+
76
+ <!-- Used when called from dotnet test command line: does not use MSBuild logs to allow for console colorization -->
77
+ <Target
78
+ Name =" _VSTestConsole"
79
+ Condition =" '$(IsTestProject)' == 'true'"
80
+ >
28
81
<CallTarget Condition =" '$(VSTestNoBuild)' != 'true' AND '$(IsTestProject)' == 'true'" Targets =" BuildProject" />
29
-
82
+
30
83
<CallTarget Targets =" ShowCallOfVSTestTaskWithParameter" />
31
84
32
- <Microsoft .TestPlatform.Build.Tasks.VSTestTask
85
+ <Microsoft .TestPlatform.Build.Tasks.VSTestForwardingTask
33
86
TestFileFullPath =" $(TargetPath)"
34
87
VSTestSetting =" $([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
35
88
VSTestTestAdapterPath =" $(VSTestTestAdapterPath)"
@@ -55,7 +108,6 @@ Copyright (c) .NET Foundation. All rights reserved.
55
108
VSTestArtifactsProcessingMode =" $(VSTestArtifactsProcessingMode)"
56
109
VSTestSessionCorrelationId =" $(VSTestSessionCorrelationId)"
57
110
VSTestNoLogo =" $(VSTestNoLogo)"
58
- Condition =" '$(IsTestProject)' == 'true'"
59
111
/>
60
112
</Target >
61
113
@@ -70,37 +122,36 @@ Copyright (c) .NET Foundation. All rights reserved.
70
122
<MSBuild Projects =" $(MSBuildProjectFullPath)" />
71
123
<Microsoft .TestPlatform.Build.Tasks.VSTestLogsTask LogType =" BuildCompleted" />
72
124
73
- <Message Text =" Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" low " />
125
+ <Message Text =" Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" Low " />
74
126
</Target >
75
127
76
128
<Target Name =" ShowMsbuildWithParameter" >
77
- <Message Text =" Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" low " />
78
- <Message Text =" Value passed to msbuild are..." Importance =" low " />
79
- <Message Text =" Configuration = $(Configuration)" Importance =" low " />
80
- <Message Text =" TargetFramework = $(TargetFramework)" Importance =" low " />
81
- <Message Text =" Platform = $(PlatformTarget)" Importance =" low " />
82
- <Message Text =" OutputPath = $(OutputPath)" Importance =" low " />
129
+ <Message Text =" Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" Low " />
130
+ <Message Text =" Value passed to msbuild are..." Importance =" Low " />
131
+ <Message Text =" Configuration = $(Configuration)" Importance =" Low " />
132
+ <Message Text =" TargetFramework = $(TargetFramework)" Importance =" Low " />
133
+ <Message Text =" Platform = $(PlatformTarget)" Importance =" Low " />
134
+ <Message Text =" OutputPath = $(OutputPath)" Importance =" Low " />
83
135
</Target >
84
136
85
137
<Target Name =" ShowCallOfVSTestTaskWithParameter" >
86
- <Message Text =" Calling task Microsoft.TestPlatform.Build.Tasks.VSTestTask with following parameter..." Importance =" low " />
87
- <Message Text =" TestFileFullPath = $(TargetPath)" Importance =" low " />
88
- <Message Text =" VSTestSetting = $(VSTestSetting)" Importance =" low " />
89
- <Message Text =" VSTestTestAdapterPath = $(VSTestTestAdapterPath)" Importance =" low " />
90
- <Message Text =" VSTestFramework = $(TargetFrameworkMoniker)" Importance =" low " />
91
- <Message Text =" VSTestPlatform = $(PlatformTarget)" Importance =" low " />
92
- <Message Text =" VSTestTestCaseFilter = $(VSTestTestCaseFilter)" Importance =" low " />
93
- <Message Text =" VSTestLogger = $(VSTestLogger)" Importance =" low " />
138
+ <Message Text =" Calling task Microsoft.TestPlatform.Build.Tasks.VSTestTask with following parameter..." Importance =" Low " />
139
+ <Message Text =" TestFileFullPath = $(TargetPath)" Importance =" Low " />
140
+ <Message Text =" VSTestSetting = $(VSTestSetting)" Importance =" Low " />
141
+ <Message Text =" VSTestTestAdapterPath = $(VSTestTestAdapterPath)" Importance =" Low " />
142
+ <Message Text =" VSTestFramework = $(TargetFrameworkMoniker)" Importance =" Low " />
143
+ <Message Text =" VSTestPlatform = $(PlatformTarget)" Importance =" Low " />
144
+ <Message Text =" VSTestTestCaseFilter = $(VSTestTestCaseFilter)" Importance =" Low " />
145
+ <Message Text =" VSTestLogger = $(VSTestLogger)" Importance =" Low " />
94
146
<Message Text =" VSTestListTests = $(VSTestListTests)" Importance =" low" />
95
- <Message Text =" VSTestDiag = $(VSTestDiag)" Importance =" low " />
96
- <Message Text =" VSTestCLIRunSettings = $(VSTestCLIRunSettings)" Importance =" low " />
97
- <Message Text =" VSTestResultsDirectory = $(VSTestResultsDirectory)" Importance =" low " />
98
- <Message Text =" VSTestConsolePath = $(VSTestConsolePath)" Importance =" low " />
99
- <Message Text =" VSTestVerbosity = $(VSTestVerbosity)" Importance =" low " />
100
- <Message Text =" VSTestCollect = $(VSTestCollect)" Importance =" low " />
101
- <Message Text =" VSTestBlame = $(VSTestBlame)" Importance =" low " />
102
- <Message Text =" VSTestTraceDataCollectorDirectoryPath = $(TraceDataCollectorDirectoryPath)" Importance =" low " />
103
- <Message Text =" VSTestNoLogo = $(VSTestNoLogo)" Importance =" low " />
147
+ <Message Text =" VSTestDiag = $(VSTestDiag)" Importance =" Low " />
148
+ <Message Text =" VSTestCLIRunSettings = $(VSTestCLIRunSettings)" Importance =" Low " />
149
+ <Message Text =" VSTestResultsDirectory = $(VSTestResultsDirectory)" Importance =" Low " />
150
+ <Message Text =" VSTestConsolePath = $(VSTestConsolePath)" Importance =" Low " />
151
+ <Message Text =" VSTestVerbosity = $(VSTestVerbosity)" Importance =" Low " />
152
+ <Message Text =" VSTestCollect = $(VSTestCollect)" Importance =" Low " />
153
+ <Message Text =" VSTestBlame = $(VSTestBlame)" Importance =" Low " />
154
+ <Message Text =" VSTestTraceDataCollectorDirectoryPath = $(TraceDataCollectorDirectoryPath)" Importance =" Low " />
155
+ <Message Text =" VSTestNoLogo = $(VSTestNoLogo)" Importance =" Low " />
104
156
</Target >
105
-
106
157
</Project >
0 commit comments