-
-
Notifications
You must be signed in to change notification settings - Fork 125
Expand file tree
/
Copy pathTUnit.Core.targets
More file actions
42 lines (36 loc) · 2.51 KB
/
TUnit.Core.targets
File metadata and controls
42 lines (36 loc) · 2.51 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
41
42
<?xml version="1.0" encoding="utf-8"?>
<Project>
<ItemGroup Condition="'$(TUnitImplicitUsings)' == 'true'">
<Using Include="TUnit.Core.HookType" Static="True" />
<Using Include="TUnit.Core" />
</ItemGroup>
<!-- Auto-include Polyfill package for compile-time type generation -->
<PropertyGroup>
<_TUnitPolyfillVersion>9.23.0</_TUnitPolyfillVersion>
<_TUnitNeedsPolyfill Condition="'$(TargetFramework)' == 'netstandard2.0' or '$(TargetFramework)' == 'netstandard2.1' or '$(TargetFrameworkIdentifier)' == '.NETFramework'">true</_TUnitNeedsPolyfill>
</PropertyGroup>
<!-- Add Polyfill for non-CPM projects -->
<ItemGroup Condition="'$(EnableTUnitPolyfills)' != 'false' and '$(_TUnitNeedsPolyfill)' == 'true' and '$(ManagePackageVersionsCentrally)' != 'true' and '$(_PolyfillAlreadyDefined)' != 'true'">
<PackageReference Include="Polyfill" Version="$(_TUnitPolyfillVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile; analyzers</IncludeAssets>
<ExcludeAssets>runtime; native; contentfiles; build; buildtransitive</ExcludeAssets>
</PackageReference>
</ItemGroup>
<!-- Add Polyfill for CPM projects (using VersionOverride to bypass CPM requirement) -->
<ItemGroup Condition="'$(EnableTUnitPolyfills)' != 'false' and '$(_TUnitNeedsPolyfill)' == 'true' and '$(ManagePackageVersionsCentrally)' == 'true' and '$(_PolyfillAlreadyDefined)' != 'true'">
<PackageReference Include="Polyfill" VersionOverride="$(_TUnitPolyfillVersion)">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>compile; analyzers</IncludeAssets>
<ExcludeAssets>runtime; native; contentfiles; build; buildtransitive</ExcludeAssets>
</PackageReference>
</ItemGroup>
<!-- Validate Polyfill availability and provide helpful messages if issues occur -->
<Target Name="_TUnitEnsurePolyfill"
BeforeTargets="GenerateBuildDependencyFile"
Condition="'$(EnableTUnitPolyfills)' != 'false' and '$(_TUnitNeedsPolyfill)' == 'true' and '$(_PolyfillAlreadyDefined)' != 'true'">
<Warning Condition="!Exists('$(NuGetPackageRoot)polyfill')"
Code="TUNIT001"
Text="TUnit attempted to automatically add Polyfill package for $(TargetFramework) but it may not be available. If you encounter issues, you can manually add it or disable automatic injection with <EnableTUnitPolyfills>false</EnableTUnitPolyfills>." />
</Target>
</Project>