@@ -12,10 +12,14 @@ Copyright (c) .NET Foundation. All rights reserved.
1212<Project xmlns =" http://schemas.microsoft.com/developer/msbuild/2003" >
1313 <!-- Load Microsoft.TestPlatform.Build.Tasks.dll, this can be overridden to use a different version with $(VSTestTaskAssemblyFile) -->
1414 <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 >
1720 </PropertyGroup >
1821 <UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
22+ <UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestForwardingTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
1923 <UsingTask TaskName =" Microsoft.TestPlatform.Build.Tasks.VSTestLogsTask" AssemblyFile =" $(VSTestTaskAssemblyFile)" />
2024
2125 <!--
@@ -24,12 +28,61 @@ Copyright (c) .NET Foundation. All rights reserved.
2428 Main entry point for running tests through vstest.console.exe
2529 ============================================================
2630 -->
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+ >
2881 <CallTarget Condition =" '$(VSTestNoBuild)' != 'true' AND '$(IsTestProject)' == 'true'" Targets =" BuildProject" />
29-
82+
3083 <CallTarget Targets =" ShowCallOfVSTestTaskWithParameter" />
3184
32- <Microsoft .TestPlatform.Build.Tasks.VSTestTask
85+ <Microsoft .TestPlatform.Build.Tasks.VSTestForwardingTask
3386 TestFileFullPath =" $(TargetPath)"
3487 VSTestSetting =" $([MSBuild]::ValueOrDefault($(VSTestSetting), '$(RunSettingsFilePath)'))"
3588 VSTestTestAdapterPath =" $(VSTestTestAdapterPath)"
@@ -55,7 +108,6 @@ Copyright (c) .NET Foundation. All rights reserved.
55108 VSTestArtifactsProcessingMode =" $(VSTestArtifactsProcessingMode)"
56109 VSTestSessionCorrelationId =" $(VSTestSessionCorrelationId)"
57110 VSTestNoLogo =" $(VSTestNoLogo)"
58- Condition =" '$(IsTestProject)' == 'true'"
59111 />
60112 </Target >
61113
@@ -70,37 +122,36 @@ Copyright (c) .NET Foundation. All rights reserved.
70122 <MSBuild Projects =" $(MSBuildProjectFullPath)" />
71123 <Microsoft .TestPlatform.Build.Tasks.VSTestLogsTask LogType =" BuildCompleted" />
72124
73- <Message Text =" Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" low " />
125+ <Message Text =" Done Building project $(MSBuildProjectFullPath) for TargetFramework=$(TargetFramework)" Importance =" Low " />
74126 </Target >
75127
76128 <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 " />
83135 </Target >
84136
85137 <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 " />
94146 <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 " />
104156 </Target >
105-
106157</Project >
0 commit comments