winforms/Directory.Build.targets

70 строки
3.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project>
<Import Project="$(RepositoryEngineeringDir)CodeStyle.targets" />
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
<Import Project="$(RepositoryEngineeringDir)packageContent.targets" />
<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
<Import Project="$(RepositoryEngineeringDir)ApiCompatibility\PublicApiAnalyzer.targets" />
<!-- to prevent using MS.NC.Platforms from SDK, which is lagging behind the version that WinForms gets from the CoreFx packages -->
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Platforms" Version="$(MicrosoftNETCorePlatformsPackageVersion)" />
</ItemGroup>
<!-- Set code coverage properties that reference properties not available in Directory.Build.props -->
<PropertyGroup Condition="'$(Coverage)' == 'true'">
<CoverletOutput>$(TargetDir)coverage\$(MSBuildProjectName).coverage</CoverletOutput>
</PropertyGroup>
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
<Platforms Condition="'$(Platform)' == 'x86'">AnyCPU;x86</Platforms>
<TestArchitectures Condition="'$(Platform)' == 'x86'">x86</TestArchitectures>
<TestArchitectures Condition="'$(Platform)' != 'x86'">x64;x86</TestArchitectures>
</PropertyGroup>
<Target Name="InstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true'">
<Coverlet.MSbuild.Tasks.InstrumentationTask
Condition="'$(CollectCoverage)' == 'true'"
Path="$(TargetPath)"
Include="$(Include)"
IncludeDirectory="$(IncludeDirectory)"
Exclude="$(Exclude)"
ExcludeByFile="$(ExcludeByFile)"
ExcludeByAttribute="$(ExcludeByAttribute)"
IncludeTestAssembly="$(IncludeTestAssembly)"
SingleHit="$(SingleHit)"
MergeWith="$(MergeWith)"
UseSourceLink="$(UseSourceLink)" >
<Output TaskParameter="InstrumenterState" PropertyName="InstrumenterState"/>
</Coverlet.MSbuild.Tasks.InstrumentationTask>
</Target>
<Target Name="GenerateCoverageResult" AfterTargets="RunTests" Condition="'$(IsUnitTestProject)' == 'true'">
<Coverlet.MSbuild.Tasks.CoverageResultTask
Condition="'$(CollectCoverage)' == 'true'"
Output="$(CoverletOutput)"
OutputFormat="$(CoverletOutputFormat)"
Threshold="$(Threshold)"
ThresholdType="$(ThresholdType)"
ThresholdStat="$(ThresholdStat)"
InstrumenterState="$(InstrumenterState)"/>
</Target>
<ItemGroup>
<!-- Set TargetingPackVersion -->
<FrameworkReference Update="Microsoft.NETCore.App"
Condition=" '$(MicrosoftNETCoreAppPackageVersion)'!='' And $(TargetFramework.StartsWith('netcoreapp5.')) ">
<TargetingPackVersion>$(MicrosoftNETCoreAppPackageVersion)</TargetingPackVersion>
</FrameworkReference>
</ItemGroup>
<PropertyGroup>
<!-- Set RuntimeFrameworkVersion to MicrosoftNETCoreAppPackageVersion from Core Setup to prevent large SDK cycle -->
<RuntimeFrameworkVersion Condition="'$(MicrosoftNETCoreAppPackageVersion)'!='' And $(TargetFramework.StartsWith('netcoreapp5.')) ">$(MicrosoftNETCoreAppPackageVersion)</RuntimeFrameworkVersion>
<!-- If TargetFramework is not netcoreapp5.x, then reset RuntimeFrameworkVersion -->
<RuntimeFrameworkVersion Condition="!$(TargetFramework.StartsWith('netcoreapp5.'))" />
</PropertyGroup>
</Project>