Skip to content

Commit

Permalink
coverlet.collector support for netstandard2.0 and net6.0 (#1578)
Browse files Browse the repository at this point in the history
* support multi target frameworks

* Update coverlet.collector.csproj
  • Loading branch information
Bertk committed Jan 15, 2024
1 parent 5bebb02 commit 59b0f9d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,15 @@ WARNING: DO NOT MODIFY this file unless you are knowledgeable about MSBuild and
-->

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<Target Name="CopyCoverletDataCollectorFiles" AfterTargets="ComputeFilesToPublish">
<ItemGroup>
<CoverletDataCollectorFiles Include="$(MSBuildThisFileDirectory)\*.*" />
<CoverletDataCollectorFiles Include="$(MSBuildThisFileDirectory)\**\*.*" />
<CoverletDataCollectorFiles Remove="@(ResolvedFileToPublish->'$(MSBuildThisFileDirectory)%(Filename)%(Extension)')" />
</ItemGroup>
<Copy SourceFiles="@(CoverletDataCollectorFiles)" DestinationFolder="$(PublishDir)%(RecursiveDir)" />

</Target>

<Target Name="SetXPlatDataCollectorPath" BeforeTargets="VSTest">
<PropertyGroup>
<VSTestTestAdapterPath>$(VSTestTestAdapterPath);$(MSBuildThisFileDirectory)</VSTestTestAdapterPath>
Expand Down
20 changes: 14 additions & 6 deletions src/coverlet.collector/coverlet.collector.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
<AssemblyTitle>coverlet.collector</AssemblyTitle>
<DevelopmentDependency>true</DevelopmentDependency>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
Expand All @@ -14,7 +14,7 @@
<SuppressDependenciesWhenPacking>true</SuppressDependenciesWhenPacking>
<TargetsForTfmSpecificContentInPackage>$(TargetsForTfmSpecificContentInPackage);PackBuildOutputs</TargetsForTfmSpecificContentInPackage>
<!-- Open issue https://github.com/NuGet/Home/issues/8941 -->
<NoWarn>$(NoWarn);NU5127</NoWarn>
<NoWarn>$(NoWarn);NU5127;NU5100</NoWarn>
<EnablePackageValidation>true</EnablePackageValidation>
<!-- disable transitive version update and use versions defined in coverlet.core -->
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
Expand Down Expand Up @@ -43,7 +43,6 @@
</ItemGroup>

<ItemGroup>
<None Update="build\**" Pack="true" PackagePath="" />
<None Include="$(MSBuildThisFileDirectory)..\..\_assets\coverlet-icon.png" Pack="true" PackagePath="\" />
<None Include="..\..\Documentation\VSTestIntegration.md" Link="VSTestIntegration.md" Pack="true" PackagePath="\">
<PackageCopyToOutput>true</PackageCopyToOutput>
Expand Down Expand Up @@ -81,11 +80,20 @@
<ProjectReference Include="$(MSBuildThisFileDirectory)..\coverlet.core\coverlet.core.csproj" />
</ItemGroup>

<ItemGroup>
<None Include="build\coverlet.collector.targets" >
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

<Target Name="PackBuildOutputs">
<ItemGroup>
<TfmSpecificPackageFile Include="$(TargetDir)\*.dll" PackagePath="build\netstandard2.0\" />
<TfmSpecificPackageFile Include="$(TargetDir)\*.pdb" PackagePath="build\netstandard2.0\" />
<TfmSpecificPackageFile Include="$(TargetDir)\*.deps.json" PackagePath="build\netstandard2.0\" />
<TfmSpecificPackageFile Include="build\coverlet.collector.targets" PackagePath="build\$(TargetFramework)" />
<TfmSpecificPackageFile Include="$(TargetPath)" PackagePath="build\$(TargetFramework)" />
<TfmSpecificPackageFile Include="$(ProjectDepsFilePath)" PackagePath="build\$(TargetFramework)" />
<TfmSpecificPackageFile Include="@(DebugSymbolsProjectOutputGroupOutput)" PackagePath="build\$(TargetFramework)" />
<TfmSpecificPackageFile Include="%(_ResolvedProjectReferencePaths.Identity)" PackagePath="build\$(TargetFramework)" />
<TfmSpecificPackageFile Include="@(ReferenceCopyLocalPaths)" Exclude="@(_ResolvedProjectReferencePaths)" PackagePath="build\$(TargetFramework)\%(ReferenceCopyLocalPaths.DestinationSubPath)" />
</ItemGroup>
</Target>
</Project>

0 comments on commit 59b0f9d

Please sign in to comment.