-
Notifications
You must be signed in to change notification settings - Fork 352
/
Copy pathDirectory.Build.targets
34 lines (27 loc) · 1.5 KB
/
Directory.Build.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
<Project>
<Import Project="..\Directory.Build.targets" />
<Import Project="..\packages\xunit.runner.msbuild.2.4.2\**\xunit.runner.msbuild.props"
Condition="$(IsTestProject) and '$(MSBuildRuntimeType)' != 'Core' and '$(TargetFrameworkIdentifier)' == '.NETFramework'" />
<Target Name="Test" DependsOnTargets="_TestWithVSTest;_TestWithDotnetTest;_TestWithRunner" />
<!-- Building with `dotnet msbuild`: Use VSTest target. -->
<Target
Name="_TestWithVSTest"
Condition="$(IsTestProject) and '$(MSBuildRuntimeType)' == 'Core'">
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="VSTest" Properties="VSTestNoBuild=true" />
</Target>
<!-- Building with `msbuild` and in outer build or building .NET Core: Use `dotnet test`. -->
<Target
Name="_TestWithDotnetTest"
Condition="$(IsTestProject) and '$(MSBuildRuntimeType)' != 'Core' and '$(TargetFrameworkIdentifier)' != '.NETFramework'">
<Exec Command='dotnet test --no-restore --no-build --verbosity minimal --configuration $(Configuration) "$(MSBuildProjectFullPath)"'/>
</Target>
<!-- Building with `msbuild`, in inner build, and building .NET Framework: Use xUnit MSBuild runner. -->
<Target
Name="_TestWithRunner"
Condition="$(IsTestProject) and '$(MSBuildRuntimeType)' != 'Core' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<ItemGroup Condition=" '@(TestAssembly)' == '' ">
<TestAssembly Include="$(TargetPath)" />
</ItemGroup>
<xunit Assemblies="@(TestAssembly)" />
</Target>
</Project>