-
Notifications
You must be signed in to change notification settings - Fork 259
/
Microsoft.Testing.Platform.MSBuild.targets
347 lines (310 loc) · 21.9 KB
/
Microsoft.Testing.Platform.MSBuild.targets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
<?xml version="1.0" encoding="utf-8" ?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="Build">
<!-- Acknowledge users choices -->
<PropertyGroup Condition=" $(IsTestingPlatformApplication) == 'True' ">
<GenerateTestingPlatformConfigurationFile Condition=" '$(GenerateTestingPlatformConfigurationFile)' == '' " >True</GenerateTestingPlatformConfigurationFile>
<GenerateTestingPlatformEntryPoint Condition=" '$(GenerateTestingPlatformEntryPoint)' == '' " >True</GenerateTestingPlatformEntryPoint>
<GenerateSelfRegisteredExtensions Condition=" '$(GenerateSelfRegisteredExtensions)' == '' ">True</GenerateSelfRegisteredExtensions>
</PropertyGroup>
<!-- Declare our capability to Visual Studio/Visual Studio Code -->
<ItemGroup Condition=" '$(DisableTestingPlatformServerCapability)' != 'True' ">
<ProjectCapability Include="TestingPlatformServer" />
<!-- Old capability expected by VS/VSCode -->
<ProjectCapability Include="TestContainer" />
</ItemGroup>
<!-- Add assembly attribute metadata for reflection usage -->
<ItemGroup>
<AssemblyMetadata Include="Microsoft.Testing.Platform.Application" Value="True" Condition=" '$(IsTestingPlatformApplication)' == 'True' " />
</ItemGroup>
<!-- Setup the task folder -->
<PropertyGroup>
<!-- Constants -->
<MicrosoftTestingPlatformMSBuildTaskFolder Condition=" $(MicrosoftTestingPlatformMSBuildTaskFolder) == '' ">$(MSBuildThisFileDirectory)..\_MSBuildTasks\netstandard2.0\</MicrosoftTestingPlatformMSBuildTaskFolder>
</PropertyGroup>
<!--
Configuration file generation
===========================
The configuration file is generated by the GenerateTestingPlatformConfigurationFile target.
We copy the file called testconfig.json from the project directory to the output directory.
The file is copied only if it does not exist in the output directory or if it has changed.
The file is copied to the output directory before the CopyFilesToOutputDirectory target is executed.
-->
<!-- Import task -->
<UsingTask TaskName="Microsoft.Testing.Platform.MSBuild.ConfigurationFileTask"
AssemblyFile="$(MicrosoftTestingPlatformMSBuildTaskFolder)Microsoft.Testing.Platform.MSBuild.dll"/>
<PropertyGroup>
<_TestingPlatformConfigurationFileSourceFileName>testconfig.json</_TestingPlatformConfigurationFileSourceFileName>
<_TestingPlatformConfigurationFileSourcePath>$([System.IO.Path]::Combine($(MSBuildProjectDirectory),$(_TestingPlatformConfigurationFileSourceFileName)))</_TestingPlatformConfigurationFileSourcePath>
<_TestingPlatformConfigurationFileName>$(AssemblyName).testconfig.json</_TestingPlatformConfigurationFileName>
<_TestingPlatformConfigurationFile>$([System.IO.Path]::Combine($(MSBuildProjectDirectory),$(OutputPath),$(_TestingPlatformConfigurationFileName)))</_TestingPlatformConfigurationFile>
</PropertyGroup>
<Target Name="GenerateTestingPlatformConfigurationFile" BeforeTargets="CopyFilesToOutputDirectory"
Inputs="$(_TestingPlatformConfigurationFileSourcePath)"
Outputs="$(_TestingPlatformConfigurationFile)"
Condition=" '$(GenerateTestingPlatformConfigurationFile)' == 'True' And Exists('$(_TestingPlatformConfigurationFileSourcePath)') " >
<ConfigurationFileTask
MSBuildProjectDirectory="$(MSBuildProjectDirectory)"
AssemblyName="$(AssemblyName)"
OutputPath="$(OutputPath)"
TestingPlatformConfigurationFileSource="$(_TestingPlatformConfigurationFileSourcePath)" >
<Output TaskParameter="FinalTestingPlatformConfigurationFile" ItemName="TestingPlatformConfigurationFile" />
</ConfigurationFileTask>
<ItemGroup>
<FileWrites Include="$(_TestingPlatformConfigurationFile)" />
</ItemGroup>
<ItemGroup>
<ResolvedFileToPublish Include="$(_TestingPlatformConfigurationFile)" >
<RelativePath>$(_TestingPlatformConfigurationFileName)</RelativePath>
</ResolvedFileToPublish>
</ItemGroup>
</Target>
<!--
Inject application entry point a.k.a. Program.* file
===========================
-->
<!-- Import task -->
<UsingTask TaskName="Microsoft.Testing.Platform.MSBuild.TestingPlatformEntryPointTask"
AssemblyFile="$(MicrosoftTestingPlatformMSBuildTaskFolder)Microsoft.Testing.Platform.MSBuild.dll"/>
<Target Name="_GenerateTestingPlatformEntryPointFileInputCache" BeforeTargets="_GenerateTestingPlatformEntryPoint" Condition=" '$(GenerateTestingPlatformEntryPoint)' == 'True' " >
<PropertyGroup>
<!-- Cache file to check -->
<_GenerateTestingPlatformEntryPointInputsCachFilePath>$(IntermediateOutputPath)$(MSBuildProjectName).gentestingplatformentrypointinputcache.cache</_GenerateTestingPlatformEntryPointInputsCachFilePath>
<_GenerateTestingPlatformEntryPointInputsCachFilePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_GenerateTestingPlatformEntryPointInputsCachFilePath)))</_GenerateTestingPlatformEntryPointInputsCachFilePath>
</PropertyGroup>
<ItemGroup>
<!-- Items to hash-->
<_GenerateTestingPlatformEntryPointInputsCacheToHash Include="@(TestingPlatformBuilderHook)"/>
<!-- Export the items name for the _GenerateTestingPlatformInjectEntryPoint task-->
<GenerateTestingPlatformEntryPointInputsCacheFilePath Include="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)" />
</ItemGroup>
<!-- Hash the extensions information -->
<Hash ItemsToHash="@(_GenerateTestingPlatformEntryPointInputsCacheToHash)">
<Output TaskParameter="HashResult" PropertyName="_GenerateTestingPlatformEntryPointInputsCache" />
</Hash>
<!-- Write the hash value to the cache file -->
<WriteLinesToFile Lines="$(_GenerateTestingPlatformEntryPointInputsCache)"
File="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)"
Overwrite="True"
WriteOnlyWhenDifferent="True" />
<ItemGroup>
<FileWrites Include="$(_GenerateTestingPlatformEntryPointInputsCachFilePath)" />
</ItemGroup>
</Target>
<!-- Generate the entry point source using the user extensions informations -->
<PropertyGroup>
<_TestingPlatformEntryPointSourceNameWithoutExtension>TestPlatformEntryPoint</_TestingPlatformEntryPointSourceNameWithoutExtension>
<_TestingPlatformEntryPointSourceName Condition=" $(Language) == 'C#' " >$(_TestingPlatformEntryPointSourceNameWithoutExtension).cs</_TestingPlatformEntryPointSourceName>
<_TestingPlatformEntryPointSourceName Condition=" $(Language) == 'VB' " >$(_TestingPlatformEntryPointSourceNameWithoutExtension).vb</_TestingPlatformEntryPointSourceName>
<_TestingPlatformEntryPointSourceName Condition=" $(Language) == 'F#' " >$(_TestingPlatformEntryPointSourceNameWithoutExtension).fs</_TestingPlatformEntryPointSourceName>
<_TestingPlatformEntryPointSourcePath>$([System.IO.Path]::Combine($(IntermediateOutputPath),$(_TestingPlatformEntryPointSourceName)))</_TestingPlatformEntryPointSourcePath>
<_TestingPlatformEntryPointSourcePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_TestingPlatformEntryPointSourcePath)))</_TestingPlatformEntryPointSourcePath>
</PropertyGroup>
<Target Name="_GenerateTestingPlatformEntryPoint" BeforeTargets="_IncludeGenerateTestingPlatformEntryPointIntoCompilation"
Inputs="@(GenerateTestingPlatformEntryPointInputsCacheFilePath)" Outputs="$(_TestingPlatformEntryPointSourcePath)"
Condition=" '$(GenerateTestingPlatformEntryPoint)' == 'True' " >
<TestingPlatformEntryPointTask TestingPlatformEntryPointSourcePath="$(_TestingPlatformEntryPointSourcePath)"
Language="$(Language)" >
<Output TaskParameter="TestingPlatformEntryPointGeneratedFilePath" PropertyName ="TestingPlatformEntryPointGeneratedFilePath" />
</TestingPlatformEntryPointTask>
<ItemGroup>
<FileWrites Include="$(_TestingPlatformEntryPointSourcePath)" />
</ItemGroup>
</Target>
<!-- We always include the entry point also if the task _GenerateTestingPlatformInjectEntryPoint is skipped for caching reason -->
<Target Name="_IncludeGenerateTestingPlatformEntryPointIntoCompilation" BeforeTargets="CoreCompile" Condition=" '$(GenerateTestingPlatformEntryPoint)' == 'True' " >
<ItemGroup>
<Compile Include="$(_TestingPlatformEntryPointSourcePath)" />
</ItemGroup>
<!-- We need to report to the FileWrites here because is possible that we skip _GenerateTestingPlatformInjectEntryPoint and we want to correctly handle the "dotnet clean" target -->
<ItemGroup>
<FileWrites Include="$(_TestingPlatformEntryPointSourcePath)" />
</ItemGroup>
</Target>
<!--
Inject AutoRegisteredExtensions
===========================
Expected extensions items shape
<ItemGroup>
<TestingPlatformBuilderHook Include="8E680F4D-E423-415A-9566-855439363BC0" >
<DisplayName>MyBuilderHook</DisplayName>
<TypeFullName>Contoso.BuilderHook</TypeFullName>
</TestingPlatformBuilderHook>
</ItemGroup>
-->
<!-- Import task -->
<UsingTask TaskName="Microsoft.Testing.Platform.MSBuild.TestingPlatformAutoRegisteredExtensions"
AssemblyFile="$(MicrosoftTestingPlatformMSBuildTaskFolder)Microsoft.Testing.Platform.MSBuild.dll"/>
<Target Name="_GenerateAutoRegisteredExtensionsFileInputCache" BeforeTargets="_GenerateTestingPlatformEntryPoint" Condition=" '$(GenerateSelfRegisteredExtensions)' == 'True' " >
<PropertyGroup>
<!-- Cache file to check -->
<_GenerateAutoRegisteredExtensionsInputsCachFilePath>$(IntermediateOutputPath)$(MSBuildProjectName).genautoregisteredextensionsinputcache.cache</_GenerateAutoRegisteredExtensionsInputsCachFilePath>
<_GenerateAutoRegisteredExtensionsInputsCachFilePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_GenerateAutoRegisteredExtensionsInputsCachFilePath)))</_GenerateAutoRegisteredExtensionsInputsCachFilePath>
</PropertyGroup>
<ItemGroup>
<!-- Items to hash-->
<_GenerateAutoRegisteredExtensionsInputsCacheToHash Include="@(TestingPlatformBuilderHook)"/>
<!-- Export the items name for the _GenerateAutoRegisteredExtensions task-->
<GenerateAutoRegisteredExtensionsInputsCacheFilePath Include="$(_GenerateAutoRegisteredExtensionsInputsCachFilePath)" />
</ItemGroup>
<!-- Hash the extensions information -->
<Hash ItemsToHash="@(_GenerateAutoRegisteredExtensionsInputsCacheToHash)">
<Output TaskParameter="HashResult" PropertyName="_GenerateAutoRegisteredExtensionsInputsCache" />
</Hash>
<!-- Write the hash value to the cache file -->
<WriteLinesToFile Lines="$(_GenerateAutoRegisteredExtensionsInputsCache)"
File="$(_GenerateAutoRegisteredExtensionsInputsCachFilePath)"
Overwrite="True"
WriteOnlyWhenDifferent="True" />
<ItemGroup>
<FileWrites Include="$(_GenerateAutoRegisteredExtensionsInputsCachFilePath)" />
</ItemGroup>
</Target>
<!-- Generate the extensions source file using the user extensions informations -->
<PropertyGroup>
<_AutoRegisteredExtensionsSourceNameWithoutExtension>AutoRegisteredExtensions</_AutoRegisteredExtensionsSourceNameWithoutExtension>
<_AutoRegisteredExtensionsSourceName Condition=" $(Language) == 'C#' " >$(_AutoRegisteredExtensionsSourceNameWithoutExtension).cs</_AutoRegisteredExtensionsSourceName>
<_AutoRegisteredExtensionsSourceName Condition=" $(Language) == 'VB' " >$(_AutoRegisteredExtensionsSourceNameWithoutExtension).vb</_AutoRegisteredExtensionsSourceName>
<_AutoRegisteredExtensionsSourceName Condition=" $(Language) == 'F#' " >$(_AutoRegisteredExtensionsSourceNameWithoutExtension).fs</_AutoRegisteredExtensionsSourceName>
<_AutoRegisteredExtensionsSourcePath>$([System.IO.Path]::Combine($(IntermediateOutputPath),$(_AutoRegisteredExtensionsSourceName)))</_AutoRegisteredExtensionsSourcePath>
<_AutoRegisteredExtensionsSourcePath>$([MSBuild]::NormalizePath($(MSBuildProjectDirectory), $(_AutoRegisteredExtensionsSourcePath)))</_AutoRegisteredExtensionsSourcePath>
</PropertyGroup>
<Target Name="_GenerateAutoRegisteredExtensions" BeforeTargets="_IncludeGenerateAutoRegisteredExtensionsIntoCompilation;_GenerateTestingPlatformEntryPoint"
Inputs="@(GenerateAutoRegisteredExtensionsInputsCacheFilePath)" Outputs="$(_AutoRegisteredExtensionsSourcePath)"
Condition=" '$(GenerateSelfRegisteredExtensions)' == 'True' " >
<TestingPlatformAutoRegisteredExtensions AutoRegisteredExtensionsSourcePath="$(_AutoRegisteredExtensionsSourcePath)"
AutoRegisteredExtensionsBuilderHook="@(TestingPlatformBuilderHook)"
Language="$(Language)" >
<Output TaskParameter="AutoRegisteredExtensionsGeneratedFilePath" PropertyName ="AutoRegisteredExtensionsGeneratedFilePath" />
</TestingPlatformAutoRegisteredExtensions>
<ItemGroup>
<FileWrites Include="$(_AutoRegisteredExtensionsSourcePath)" />
</ItemGroup>
</Target>
<!-- We always include the entry point also if the task _GenerateAutoRegisteredExtensions is skipped for caching reason -->
<!-- !!! DO NOT CHANGE THE NAME OF THIS TARGET IS USED BY ADAPTERS https://github.com/microsoft/testfx/issues/3478#issuecomment-2313889212 !!! -->
<Target Name="_IncludeGenerateAutoRegisteredExtensionsIntoCompilation" BeforeTargets="_IncludeGenerateTestingPlatformEntryPointIntoCompilation;CoreCompile" Condition=" '$(GenerateSelfRegisteredExtensions)' == 'True' " >
<ItemGroup>
<Compile Include="$(_AutoRegisteredExtensionsSourcePath)" />
</ItemGroup>
<!-- We need to report to the FileWrites here because is possible that we skip _GenerateAutoRegisteredExtensions and we want to correctly handle the "dotnet clean" target -->
<ItemGroup>
<FileWrites Include="$(_AutoRegisteredExtensionsSourcePath)" />
</ItemGroup>
</Target>
<!--
Hook the testing platform
===========================
Entry points targets:
* VSTest: Overrides the SDK VSTest target for single tfm, we use the built-in multitfm workflow https://github.com/dotnet/sdk/blob/main/src/Layout/redist/MSBuildImports/Current/Microsoft.Common.CrossTargeting.targets/ImportAfter/Microsoft.TestPlatform.CrossTargeting.targets#L79
* Test: We plug ourself to the available VSTest target for multitfm and we go directly to our target for single tfm
-->
<!-- Import task -->
<UsingTask TaskName="Microsoft.Testing.Platform.MSBuild.InvokeTestingPlatformTask"
AssemblyFile="$(MicrosoftTestingPlatformMSBuildTaskFolder)Microsoft.Testing.Platform.MSBuild.dll"/>
<PropertyGroup>
<!-- Disable custom -t:Test target -->
<TestingPlatformDisableCustomTestTarget Condition=" '$(TestingPlatformDisableCustomTestTarget)' == '' ">False</TestingPlatformDisableCustomTestTarget>
<!-- Support dotnet test -->
<TestingPlatformDotnetTestSupport Condition=" '$(TestingPlatformDotnetTestSupport)' == '' ">False</TestingPlatformDotnetTestSupport>
<!--
Verify if the <UseMSBuildTestInfrastructure> is available
https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.CurrentVersion.targets#L6807
https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.Test.targets
-->
<_MSBuildTestInfrastructureAvailable Condition="Exists('$(MSBuildExtensionsPath)\Microsoft.Common.Test.targets')" >True</_MSBuildTestInfrastructureAvailable>
</PropertyGroup>
<Target Name="_SetCustomVSTargetForVSTest" BeforeTargets="VSTest" Condition=" '$(TestingPlatformDotnetTestSupport)' == 'True' ">
<PropertyGroup>
<!-- Set our VSTest target for the multi-tfm workflow -->
<InnerVSTestTargets Condition=" '$(TestingPlatformDotnetTestSupport)' == 'True' " >InvokeTestingPlatform</InnerVSTestTargets>
</PropertyGroup>
</Target>
<!-- Override VSTest only in case of single tfm, for multitfm we rely on built-in mechanism -->
<Import Project="$(MSBuildThisFileDirectory)Microsoft.Testing.Platform.MSBuild.VSTest.targets"
Condition=" '$(TargetFramework)' != '' AND '$(TestingPlatformDotnetTestSupport)' == 'True' "/>
<!-- Rely on VSTest infra -->
<!-- We setup the InnerVSTestTargets is we're using the MSBuild infrastructure or if user didn't disble the custom test target -->
<Target Name="_SetCustomVSTargetForTest" BeforeTargets="Test" Condition=" ( '$(UseMSBuildTestInfrastructure)' == 'True' AND '$(_MSBuildTestInfrastructureAvailable)' == 'True' ) OR '$(TestingPlatformDisableCustomTestTarget)' == 'False' " >
<PropertyGroup>
<InnerVSTestTargets>InvokeTestingPlatform</InnerVSTestTargets>
</PropertyGroup>
</Target>
<!-- Plug with the new msbuild target
https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.CurrentVersion.targets#L6807
https://github.com/dotnet/msbuild/blob/main/src/Tasks/Microsoft.Common.Test.targets
-->
<Target Name="_MSBuildTest" AfterTargets="Test" Condition=" '$(UseMSBuildTestInfrastructure)' == 'True' AND '$(_MSBuildTestInfrastructureAvailable)' == 'True' " >
<CallTarget Targets="_TestingPlatformTest" />
</Target>
<!-- Expose a test target usable by tests projects where this target is injected -->
<Target Name="Test" Condition=" '$(UseMSBuildTestInfrastructure)' != 'True' AND '$(TestingPlatformDisableCustomTestTarget)' == 'False' " >
<CallTarget Targets="_TestingPlatformTest" />
</Target>
<Target Name="_TestingPlatformTest">
<!-- We call VSTest built-in workflow only for the multi-tfm for single tfm we need to directly call our target -->
<CallTarget Targets="VSTest" Condition=" '$(TargetFramework)' == '' "/>
<!-- For single tfm we call directly our target like we're doing for single tfm and VSTest -->
<CallTarget Targets="_BuildAndInvokeTestingPlatform" Condition=" '$(TargetFrameworks)' == '' "/>
</Target>
<!-- Override VSTest target for single tfm -->
<Target Name="_BuildAndInvokeTestingPlatform" >
<!--
When the project is not built, build it. dotnet/sdk will call us always with this property set to true.
This is only needed for direct call to this target, e.g. dotnet build -t:vstest.
-->
<MSBuild Condition="'$(VSTestNoBuild)' != 'true'" Projects="$(MSBuildProjectFullPath)" />
<CallTarget Targets="InvokeTestingPlatform" />
</Target>
<!-- Invoke the tool task -->
<PropertyGroup>
<!--
The architecture below is used for log name, but it does not impact the architecture of the exe we will start.
We are basically trying to guess what we've just built and what architecture it has.
-->
<_TestArchitecture>$(PlatformTarget)</_TestArchitecture>
<!--
DefaultAppHostRuntimeIdentifier will tell us what is the architecture of the apphost
SDK runtime will build when not overridden. This takes TargetFramework into account so it is more accurate. This value depends on the actual architecture of the SDK, e.g. win-x64, or win-arm64.
-->
<_TestArchitecture Condition="('$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu') and '$(DefaultAppHostRuntimeIdentifier)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(DefaultAppHostRuntimeIdentifier), '.*-', ''))</_TestArchitecture>
<!--
NETCoreSdkRuntimeIdentifier is used by DefaultAppHostRuntimeIdentifier to figure out the architecture, and is defined also for .NET Framework.
-->
<_TestArchitecture Condition="('$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu') and '$(NETCoreSdkRuntimeIdentifier)' != ''">$([System.Text.RegularExpressions.Regex]::Replace($(DefaultAppHostRuntimeIdentifier), '.*-', ''))</_TestArchitecture>
<!-- If everyting else fails, fallback to x64. -->
<_TestArchitecture Condition="'$(_TestArchitecture)' == '' or '$(_TestArchitecture)' == 'AnyCpu'">x64</_TestArchitecture>
<TestingPlatformShowTestsFailure Condition=" '$(TestingPlatformShowTestsFailure)' == '' ">False</TestingPlatformShowTestsFailure>
<TestingPlatformCaptureOutput Condition=" '$(TestingPlatformCaptureOutput)' == '' " >True</TestingPlatformCaptureOutput>
</PropertyGroup>
<Target Name="InvokeTestingPlatform" >
<!--
This target name is hardcoded in TerminalLogger to mean start of test workload.
This let's terminal logger know that it should show `Testing` in the output,
and not the additional internal details, such as target names.
-->
<CallTarget Targets="_TestRunStart" />
<InvokeTestingPlatformTask TargetPath="$(TargetPath)"
TargetFrameworkIdentifier="$(TargetFrameworkIdentifier)"
TargetFramework="$(TargetFramework)"
TestArchitecture="$(_TestArchitecture)"
ProjectFullPath="$(MSBuildProjectFullPath)"
TestingPlatformShowTestsFailure="$(TestingPlatformShowTestsFailure)"
TestingPlatformCommandLineArguments="$(TestingPlatformCommandLineArguments)"
VSTestCLIRunSettings="$(VSTestCLIRunSettings)"
TestingPlatformCaptureOutput="$(TestingPlatformCaptureOutput)"
DotnetHostPath="$(DOTNET_HOST_PATH)" />
</Target>
<Target Name="_TestRunStart" />
<Target Name="_SetTestingPlatformDefaultsForContainerBuild" BeforeTargets="ComputeContainerConfig"
Condition="'$(IsPublishable)' == 'true' AND '$(EnableSdkContainerSupport)' == 'true' AND !$(RuntimeIdentifier.StartsWith('win'))">
<!--
When PublishContainer target is used to create a docker image for the test project, it will try to write /app/TestResults folder
which is a non-writable folder. The environment variable below (notice double underscore) is used to override option defaults, and is picked up
EnvironmentVariablesConfigurationProvider.
ComputeContainerConfig is target that PublishContainer depends on to figure out the configuration for the container.
-->
<ItemGroup>
<ContainerEnvironmentVariable Include="platformOptions__resultDirectory" Value="/tmp/TestResults"></ContainerEnvironmentVariable>
</ItemGroup>
</Target>
</Project>