Exclude unknown version from harvested supported frameworks
authorWes Haggard <Wes.Haggard@microsoft.com>
Mon, 27 Aug 2018 21:51:38 +0000 (14:51 -0700)
committerWes Haggard <Wes.Haggard@microsoft.com>
Wed, 29 Aug 2018 00:56:47 +0000 (17:56 -0700)
A number of packages have harvested supported frameworks
that we cannot determine the version for because they are placeholders
for inbox components so we are just excluding them from
the list of supported frameworks to verify since we don't have a great
way to determine the correct versions.

Commit migrated from https://github.com/dotnet/corefx/commit/91125724bd2d2153ca95cd2be31ffe1c5e2f1b3c

src/libraries/Directory.Build.targets

index 1596afd..0d8bc24 100644 (file)
@@ -11,7 +11,7 @@
   </PropertyGroup>
 
   <Import Project="..\Directory.Build.targets" />
-  
+
   <Target Name="AddSkipGetTargetFrameworkToProjectReferences" Condition="'@(ProjectReference)' != ''">
     <ItemGroup>
       <ProjectReference>
@@ -27,7 +27,7 @@
     -->
     <GenerateCompiledExpressionsTempFilePathForEditing></GenerateCompiledExpressionsTempFilePathForEditing>
   </PropertyGroup>
-  
+
   <!--
   Hack workaround for not restoring each project. Instead, we turn off all the targets
   that require a `project.assets.json`, since ours will be empty anyway.
   <Target Name="DumpTargets" BeforeTargets="ResolveProjectReferences">
     <Message Text="DumpTargets> $(OutputPath), C=[$(Configuration)], CG=[$(ConfigurationGroup)], OG=[$(OSGroup)], TG=[$(TargetGroup)]" Importance="Low" />
   </Target>
-</Project> 
+
+  <!--
+    Harvesting supported versions can sometimes lead to unknown versions when harvesting a package
+    which has placeholders for older frameworks like net45. We should just exclude those from validation
+    since we cannot easily determine what they are without looking at each specific platform itself.
+  -->
+  <Target Name="ExcludeSupportedFrameworksWithUnknownVersion" BeforeTargets="ValidateLibraryPackage">
+    <ItemGroup>
+      <SupportedFramework Remove="@(SupportedFramework)" Condition="'%(SupportedFramework.Version)' == 'unknown'" />
+    </ItemGroup>
+  </Target>
+</Project>