Multi-target RuntimeConfigParser task (#52618)
authorSteve Pfister <steveisok@users.noreply.github.com>
Tue, 11 May 2021 23:37:30 +0000 (19:37 -0400)
committerGitHub <noreply@github.com>
Tue, 11 May 2021 23:37:30 +0000 (19:37 -0400)
Fixes https://github.com/dotnet/runtime/issues/52571

src/tasks/RuntimeConfigParser/RuntimeConfigParser.csproj

index 60e1899f388572e758951b7686c57a3aafe2720f..5b491a31fc362f6fa4831995278e8248f41b83a6 100644 (file)
@@ -1,11 +1,13 @@
 <Project Sdk="Microsoft.NET.Sdk">
   <PropertyGroup>
-    <TargetFramework>$(NetCoreAppToolCurrent)</TargetFramework>
+    <TargetFrameworks>$(NetCoreAppToolCurrent);$(TargetFrameworkForNETFramework)</TargetFrameworks>
     <OutputType>Library</OutputType>
     <TreatWarningsAsErrors>true</TreatWarningsAsErrors>
     <EnableDefaultCompileItems>false</EnableDefaultCompileItems>
     <Nullable>enable</Nullable>
     <NoWarn>$(NoWarn),CA1050</NoWarn>
+    <!-- Ignore nullable warnings on net4* -->
+    <NoWarn Condition="$(TargetFramework.StartsWith('net4'))">$(NoWarn),CS8604,CS8602</NoWarn>
   </PropertyGroup>
   <ItemGroup>
     <PackageReference Include="Microsoft.Build" Version="$(RefOnlyMicrosoftBuildVersion)" />
   <!-- GetFilesToPackage assists to place `RuntimeConfigParser.dll` in a NuGet package in Microsoft.NET.Runtime.RuntimeConfigParser.Task.pkgproj for external use -->
   <Target Name="GetFilesToPackage" Returns="@(FilesToPackage)">
     <ItemGroup>
-      <FilesToPackage Include="$(OutputPath)$(AssemblyName).dll" TargetPath="tasks" />
+      <_PublishFramework Remove="@(_PublishFramework)" />
+      <_PublishFramework Include="$(TargetFrameworks)" />
+
+      <FilesToPackage Include="$(OutputPath)%(_PublishFramework.Identity)\$(AssemblyName).dll" TargetPath="tasks\%(_PublishFramework.Identity)" />
     </ItemGroup>
   </Target>