Repository navigation
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
40 lines (34 loc) · 2.25 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
40 lines (34 loc) · 2.25 KB
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
<Project>
<!-- FluentAssertions namespace is provided by the AwesomeAssertions package (kept by name
for backward compat) added below for MSTest.Sdk projects. -->
<ItemGroup Condition="'$(IsTestProject)' == 'true' OR '$(UsingMSTestSdk)' == 'true'">
<Using Include="FluentAssertions" />
</ItemGroup>
<!-- Microsoft.NET.TestFramework helper namespaces are shared by every test project that
references the SDK test framework (the legacy Microsoft.NET.TestFramework or its MSTest
counterpart Microsoft.NET.TestFramework.MSTest). Detecting that ProjectReference lets us
declare these global usings once here instead of repeating them in each test csproj.
The two framework projects themselves reference neither and keep their own local usings,
and projects without the reference are skipped so the usings can't fail with CS0246. -->
<ItemGroup Condition="'@(ProjectReference->WithMetadataValue('Filename', 'Microsoft.NET.TestFramework'))' != '' OR '@(ProjectReference->WithMetadataValue('Filename', 'Microsoft.NET.TestFramework.MSTest'))' != ''">
<Using Include="Microsoft.NET.TestFramework" />
<Using Include="Microsoft.NET.TestFramework.Assertions" />
<Using Include="Microsoft.NET.TestFramework.Commands" />
<Using Include="Microsoft.NET.TestFramework.ProjectConstruction" />
<Using Include="Microsoft.NET.TestFramework.Utilities" />
</ItemGroup>
<!-- AwesomeAssertions package reference for MSTest.Sdk projects (provides the FluentAssertions
namespace used above). -->
<ItemGroup Condition="'$(UsingMSTestSdk)' == 'true'">
<PackageReference Include="AwesomeAssertions" />
</ItemGroup>
<!-- Temporary workaround for https://github.com/microsoft/vstest/pull/15794:
Microsoft.CodeCoverage overwrites project-selected publish assets, so restore them afterward. -->
<Target Name="RestoreResolvedFilesAfterCodeCoverageCopy"
AfterTargets="CopyTraceDataCollectorArtifacts"
Condition="'$(IsTestProject)' == 'true' and '$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Copy SourceFiles="@(ResolvedFileToPublish)"
DestinationFiles="@(ResolvedFileToPublish->'$(PublishDir)%(RelativePath)')" />
</Target>
<Import Project="..\Directory.Build.targets" />
</Project>