2 ***********************************************************************************************
3 Microsoft.TestPlatform.CrossTargeting.targets
5 WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and have
6 created a backup copy. Incorrect changes to this file will make it
7 impossible to load or build your projects from the command-line or the IDE.
9 Copyright (c) .NET Foundation. All rights reserved.
10 ***********************************************************************************************
12 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
14 <VSTestTaskAssemblyFile Condition="$(VSTestTaskAssemblyFile) == ''">$(MSBuildExtensionsPath)\Microsoft.TestPlatform.Build.dll</VSTestTaskAssemblyFile>
15 <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
17 <UsingTask TaskName="Microsoft.TestPlatform.Build.Tasks.BuildLogTask" AssemblyFile="$(VSTestTaskAssemblyFile)" />
19 ===================================================================================
20 DispatchToInnerBuildsWithVSTestTarget
22 Builds this project with /t:$(InnerVSTestTargets) /p:TargetFramework=X for each
23 value X in $(TargetFrameworks)
26 $(TargetFrameworks) - Semicolon delimited list of target frameworks.
27 $(InnerVSTestTargets) - The targets to build for each target framework
30 @(InnerOutput) - The combined output items of inner targets across
31 all target frameworks..
33 ===================================================================================
36 <Target Name="DispatchToInnerBuildsWithVSTestTarget" Returns="@(InnerOutput)">
38 <_TargetFramework Include="$(TargetFrameworks)" />
40 <MSBuild Projects="$(MSBuildProjectFile)"
41 Condition="'$(TargetFrameworks)' != '' "
42 Targets="$(InnerVSTestTargets)"
43 Properties="TargetFramework=%(_TargetFramework.Identity);VSTestNoBuild=true"
44 ContinueOnError="ErrorAndContinue">
45 <Output ItemName="InnerOutput" TaskParameter="TargetOutputs" />
50 ==================================================================================
53 Cross-targeting version of VSTest.
56 $(TargetFrameworks) - Semicolon delimited list of target frameworks.
57 $(InnerVSTestTargets) - The targets to build for each target framework. Defaults
58 to 'VSTest' if unset, but allows override to support
59 `msbuild /p:InnerTargets=X;Y;Z` which will build X, Y,
60 and Z targets for each target framework.
63 @(InnerOutput) - The combined output items of the inner targets across
65 =================================================================================
67 <Target Name="VSTest" >
68 <CallTarget Condition="'$(VSTestNoBuild)' != 'true'" Targets="BuildProject" />
69 <CallTarget Targets="SetVSTestInnerTarget" />
70 <CallTarget Targets="DispatchToInnerBuildsWithVSTestTarget" />
73 <Target Name="BuildProject">
74 <Microsoft.TestPlatform.Build.Tasks.BuildLogTask BuildStarted="True" />
75 <CallTarget Targets="Build" />
76 <Microsoft.TestPlatform.Build.Tasks.BuildLogTask />
79 <Target Name="SetVSTestInnerTarget" Returns="@(InnerOutput)">
80 <PropertyGroup Condition="'$(InnerVSTestTargets)' == ''">
81 <InnerVSTestTargets>VSTest</InnerVSTestTargets>