You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
5.2 KiB
102 lines
5.2 KiB
<Project>
|
|
|
|
<Import Project="$(RepositoryEngineeringDir)Analyzer.targets" />
|
|
<Import Project="Sdk.targets" Sdk="Microsoft.DotNet.Arcade.Sdk" />
|
|
<Import Project="$(RepositoryEngineeringDir)packageContent.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)versioning.targets" />
|
|
<Import Project="$(RepositoryEngineeringDir)Test.targets" Condition="'$(IsTestProject)' == 'true' "/>
|
|
|
|
<!-- CA1416 Validate platform compatibility. Do not apply to netstandard as it does not have the attribute. -->
|
|
<ItemGroup>
|
|
<AssemblyAttribute Include="System.Runtime.Versioning.SupportedOSPlatform" Condition="!$(TargetFramework.StartsWith('netstandard'))">
|
|
<!-- This tells the analyzer that we are targeting windows6.1 (windows 7). -->
|
|
<_Parameter1>windows6.1</_Parameter1>
|
|
</AssemblyAttribute>
|
|
</ItemGroup>
|
|
|
|
<!-- 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" PrivateAssets="all" />
|
|
</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>
|
|
|
|
<!-- Turn on single-file publishing analysis for everything except the test projects -->
|
|
<PropertyGroup Condition="'$(IsTestProject)' != 'true'">
|
|
<EnableSingleFileAnalyzer Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</EnableSingleFileAnalyzer>
|
|
</PropertyGroup>
|
|
|
|
<!-- Turn OFF Trimming for non .NET projects.-->
|
|
<PropertyGroup>
|
|
<EnableTrimAnalyzer Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net6.0'))">true</EnableTrimAnalyzer>
|
|
<EnableTrimAnalyzer Condition="$(IsTestProject) or $(IsAnalyzerProject) or $(MSBuildProjectDirectory.Contains('\tests\'))">false</EnableTrimAnalyzer>
|
|
</PropertyGroup>
|
|
|
|
<!-- Mark all projects located under **\tests\* folders as non-shipping -->
|
|
<PropertyGroup>
|
|
<_ProjectDirectoryRelativePath>$([MSBuild]::MakeRelative($(RepoRoot), $(MSBuildProjectDirectory)))</_ProjectDirectoryRelativePath>
|
|
<_IsUnderTestsFolder>$(_ProjectDirectoryRelativePath.Contains("\tests\"))</_IsUnderTestsFolder>
|
|
<IsShipping Condition="$(_IsUnderTestsFolder)">false</IsShipping>
|
|
<RedistTargetFrameworkName>$(NetCurrent)</RedistTargetFrameworkName>
|
|
</PropertyGroup>
|
|
|
|
<Target Name="InstrumentModulesNoBuild" BeforeTargets="RunTests" Condition="'$(IsTestProject)' == '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="'$(IsTestProject)' == '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=" '$(MicrosoftNETCoreAppRefPackageVersion)'!='' And $(TargetFramework.StartsWith('$(RedistTargetFrameworkName)')) ">
|
|
<TargetingPackVersion>$(MicrosoftNETCoreAppRefPackageVersion)</TargetingPackVersion>
|
|
</FrameworkReference>
|
|
</ItemGroup>
|
|
|
|
<PropertyGroup>
|
|
<RuntimeFrameworkVersion Condition="'$(MicrosoftNETCoreAppRefPackageVersion)'!='' And $(TargetFramework.StartsWith('$(RedistTargetFrameworkName)')) ">$(MicrosoftNETCoreAppRefPackageVersion)</RuntimeFrameworkVersion>
|
|
|
|
<!-- If TargetFramework is not net8.x, then reset RuntimeFrameworkVersion -->
|
|
<RuntimeFrameworkVersion Condition="!$(TargetFramework.StartsWith('$(RedistTargetFrameworkName)'))" />
|
|
</PropertyGroup>
|
|
|
|
<!-- If a tfm doesn't target .NETCoreApp but uses the platform support attributes, then we include the
|
|
System.Runtime.Versioning*Platform* annotation attribute classes in the project as internal.
|
|
|
|
If a project has specified assembly-level SupportedOSPlatforms or UnsupportedOSPlatforms,
|
|
we can infer the need without having IncludePlatformAttributes set. -->
|
|
<PropertyGroup>
|
|
<IncludePlatformAttributes Condition="'$(IncludePlatformAttributes)' == '' and ('$(SupportedOSPlatforms)' != '' or '$(UnsupportedOSPlatforms)' != '')">true</IncludePlatformAttributes>
|
|
</PropertyGroup>
|
|
|
|
<ItemGroup Condition="'$(IncludePlatformAttributes)' == 'true' and '$(TargetFrameworkIdentifier)' != '.NETCoreApp'">
|
|
<Compile Include="$(RepoRoot)src\Common\src\PlatformAttributes.cs" />
|
|
</ItemGroup>
|
|
|
|
</Project>
|