Fix CoreLib build when building libraries solutions (#40097)
authorViktor Hofer <viktor.hofer@microsoft.com>
Wed, 29 Jul 2020 21:39:02 +0000 (23:39 +0200)
committerGitHub <noreply@github.com>
Wed, 29 Jul 2020 21:39:02 +0000 (23:39 +0200)
If a project that is part of solution has a ProjectReference to CoreLib, the Platform property was set to AnyCPU and CoreLib was built with the wrong Platform/Platform_Target.

src/libraries/Directory.Build.targets

index 95dae26..cc196f2 100644 (file)
         <SkipGetTargetFrameworkProperties>true</SkipGetTargetFrameworkProperties>
       </ProjectReference>
       <ProjectReference Condition="'%(Filename)' == 'System.Private.CoreLib'">
-        <UndefineProperties>$(UndefineProperties);TargetFramework</UndefineProperties>
+        <!-- Don't flow TargetFramework and Platform to use same inputs and outputs as the CoreLib's build as part of the runtime. -->
+        <UndefineProperties>$(UndefineProperties);TargetFramework;Platform</UndefineProperties>
         <SetConfiguration Condition="'$(RuntimeFlavor)' == 'CoreCLR' and
                                      '$(Configuration)' != '$(CoreCLRConfiguration)'">Configuration=$(CoreCLRConfiguration)</SetConfiguration>
         <SetConfiguration Condition="'$(RuntimeFlavor)' == 'Mono' and