Skip to content

Commit 3a249b7

Browse files
authored
Drawing: Replace harvested assets with live config (#51934)
* Drawing: Replace harvested assets with live config Removing the netcoreapp2.0, netstandard2.0 and net461 configurations of System.Drawing.Common as these aren't built live anymore (harvested). Replace the netstandard2.0 and net461 harvested asset with live builds and stop supporting netcoreapp2.x. Bringing these assets back as the minimum supported set of platforms are ones that support netstandard2.0 and are still in support. Contributes to #47530
1 parent ebdcb5e commit 3a249b7

8 files changed

+101
-17
lines changed

src/libraries/System.Drawing.Common/pkg/System.Drawing.Common.pkgproj

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,14 @@
22
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />
33
<ItemGroup>
44
<ProjectReference Include="..\ref\System.Drawing.Common.csproj">
5-
<SupportedFramework>netcoreapp3.0</SupportedFramework>
5+
<SupportedFramework>net461;uap10.0.16299;netcoreapp2.0;$(AllXamarinFrameworks)</SupportedFramework>
66
</ProjectReference>
77
<ProjectReference Include="..\src\System.Drawing.Common.csproj" />
8-
<HarvestIncludePaths Include="runtimes/win/lib/netcoreapp2.0;runtimes/unix/lib/netcoreapp2.0" />
9-
<HarvestIncludePaths Include="ref/netstandard2.0;lib/netstandard2.0" />
10-
<HarvestIncludePaths Include="ref/net461;lib/net461" />
118
<InboxOnTargetFramework Include="$(AllXamarinFrameworks)" />
9+
<PackageFile Include="buildTransitive\System.Drawing.Common.targets"
10+
TargetPath="buildTransitive\netcoreapp2.0" />
11+
<File Include="$(PlaceHolderFile)"
12+
TargetPath="buildTransitive\netcoreapp3.0" />
1213
</ItemGroup>
1314
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.targets))" />
1415
</Project>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<Project InitialTargets="_ErrorForSystemDrawingCommonOnNetCoreApp2x">
2+
<Target Name="_ErrorForSystemDrawingCommonOnNetCoreApp2x"
3+
Condition="'$(SuppressTfmSupportBuildWarnings)' == ''">
4+
<Error Text="System.Drawing.Common doesn't support $(TargetFramework). Consider updating your TargetFramework to netcoreapp3.1 or later." />
5+
</Target>
6+
</Project>

src/libraries/System.Drawing.Common/ref/System.Drawing.Common.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ internal Graphics() { }
418418
public int TextContrast { get { throw null; } set { } }
419419
public System.Drawing.Text.TextRenderingHint TextRenderingHint { get { throw null; } set { } }
420420
public System.Drawing.Drawing2D.Matrix Transform { get { throw null; } set { } }
421-
public System.Numerics.Matrix3x2 TransformElements { get { throw null; } set { } }
422421
public System.Drawing.RectangleF VisibleClipBounds { get { throw null; } }
423422
public void AddMetafileComment(byte[] data) { }
424423
public System.Drawing.Drawing2D.GraphicsContainer BeginContainer() { throw null; }
@@ -1660,9 +1659,7 @@ public Matrix() { }
16601659
public Matrix(System.Drawing.Rectangle rect, System.Drawing.Point[] plgpts) { }
16611660
public Matrix(System.Drawing.RectangleF rect, System.Drawing.PointF[] plgpts) { }
16621661
public Matrix(float m11, float m12, float m21, float m22, float dx, float dy) { }
1663-
public Matrix(System.Numerics.Matrix3x2 matrix) { }
16641662
public float[] Elements { get { throw null; } }
1665-
public System.Numerics.Matrix3x2 MatrixElements { get { throw null; } set { } }
16661663
public bool IsIdentity { get { throw null; } }
16671664
public bool IsInvertible { get { throw null; } }
16681665
public float OffsetX { get { throw null; } }

src/libraries/System.Drawing.Common/ref/System.Drawing.Common.csproj

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>$(NetCoreAppCurrent);netcoreapp3.0</TargetFrameworks>
3+
<TargetFrameworks>$(NetCoreAppCurrent);netcoreapp3.0;netstandard2.0;net461</TargetFrameworks>
44
<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
55
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
8+
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
9+
<PropertyGroup>
10+
<IsPartialFacadeAssembly Condition="'$(TargetFramework)' == 'net461'">true</IsPartialFacadeAssembly>
11+
</PropertyGroup>
812
<ItemGroup>
913
<Compile Include="System.Drawing.Common.cs" />
10-
<Compile Include="System.Drawing.Common.Forwards.cs" />
14+
<Compile Include="System.Drawing.Common.netcoreapp.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
15+
<Compile Include="System.Drawing.Common.Forwards.cs" Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'" />
16+
<Compile Include="System.Drawing.Common.netstandard.cs" Condition="'$(TargetFrameworkIdentifier)' != '.NETCoreApp'" />
1117
</ItemGroup>
12-
<ItemGroup Condition="'$(TargetFramework)' != 'netcoreapp3.0'">
18+
<ItemGroup Condition="'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
1319
<ProjectReference Include="..\..\System.Collections.NonGeneric\ref\System.Collections.NonGeneric.csproj" />
1420
<ProjectReference Include="..\..\System.ComponentModel\ref\System.ComponentModel.csproj" />
1521
<ProjectReference Include="..\..\System.ComponentModel.Primitives\ref\System.ComponentModel.Primitives.csproj" />
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// ------------------------------------------------------------------------------
4+
// Changes to this file must follow the https://aka.ms/api-review process.
5+
// ------------------------------------------------------------------------------
6+
7+
namespace System.Drawing
8+
{
9+
public sealed partial class Graphics
10+
{
11+
public System.Numerics.Matrix3x2 TransformElements { get { throw null; } set { } }
12+
}
13+
}
14+
namespace System.Drawing.Drawing2D
15+
{
16+
public sealed partial class Matrix
17+
{
18+
public Matrix(System.Numerics.Matrix3x2 matrix) { }
19+
public System.Numerics.Matrix3x2 MatrixElements { get { throw null; } set { } }
20+
}
21+
}
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
// ------------------------------------------------------------------------------
4+
// Changes to this file must follow the https://aka.ms/api-review process.
5+
// ------------------------------------------------------------------------------
6+
7+
namespace System.Drawing
8+
{
9+
public static partial class ColorTranslator
10+
{
11+
public static System.Drawing.Color FromHtml(string htmlColor) { throw null; }
12+
public static System.Drawing.Color FromOle(int oleColor) { throw null; }
13+
public static System.Drawing.Color FromWin32(int win32Color) { throw null; }
14+
public static string ToHtml(System.Drawing.Color c) { throw null; }
15+
public static int ToOle(System.Drawing.Color c) { throw null; }
16+
public static int ToWin32(System.Drawing.Color c) { throw null; }
17+
}
18+
public static partial class SystemColors
19+
{
20+
public static System.Drawing.Color ActiveBorder { get { throw null; } }
21+
public static System.Drawing.Color ActiveCaption { get { throw null; } }
22+
public static System.Drawing.Color ActiveCaptionText { get { throw null; } }
23+
public static System.Drawing.Color AppWorkspace { get { throw null; } }
24+
public static System.Drawing.Color ButtonFace { get { throw null; } }
25+
public static System.Drawing.Color ButtonHighlight { get { throw null; } }
26+
public static System.Drawing.Color ButtonShadow { get { throw null; } }
27+
public static System.Drawing.Color Control { get { throw null; } }
28+
public static System.Drawing.Color ControlDark { get { throw null; } }
29+
public static System.Drawing.Color ControlDarkDark { get { throw null; } }
30+
public static System.Drawing.Color ControlLight { get { throw null; } }
31+
public static System.Drawing.Color ControlLightLight { get { throw null; } }
32+
public static System.Drawing.Color ControlText { get { throw null; } }
33+
public static System.Drawing.Color Desktop { get { throw null; } }
34+
public static System.Drawing.Color GradientActiveCaption { get { throw null; } }
35+
public static System.Drawing.Color GradientInactiveCaption { get { throw null; } }
36+
public static System.Drawing.Color GrayText { get { throw null; } }
37+
public static System.Drawing.Color Highlight { get { throw null; } }
38+
public static System.Drawing.Color HighlightText { get { throw null; } }
39+
public static System.Drawing.Color HotTrack { get { throw null; } }
40+
public static System.Drawing.Color InactiveBorder { get { throw null; } }
41+
public static System.Drawing.Color InactiveCaption { get { throw null; } }
42+
public static System.Drawing.Color InactiveCaptionText { get { throw null; } }
43+
public static System.Drawing.Color Info { get { throw null; } }
44+
public static System.Drawing.Color InfoText { get { throw null; } }
45+
public static System.Drawing.Color Menu { get { throw null; } }
46+
public static System.Drawing.Color MenuBar { get { throw null; } }
47+
public static System.Drawing.Color MenuHighlight { get { throw null; } }
48+
public static System.Drawing.Color MenuText { get { throw null; } }
49+
public static System.Drawing.Color ScrollBar { get { throw null; } }
50+
public static System.Drawing.Color Window { get { throw null; } }
51+
public static System.Drawing.Color WindowFrame { get { throw null; } }
52+
public static System.Drawing.Color WindowText { get { throw null; } }
53+
}
54+
}

src/libraries/System.Drawing.Common/src/System.Drawing.Common.csproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,14 @@
55
<WarningsNotAsErrors>CS0618</WarningsNotAsErrors>
66
<DefineConstants Condition="'$(TargetsWindows)' == 'true'">$(DefineConstants);FEATURE_WINDOWS_SYSTEM_COLORS;FEATURE_SYSTEM_EVENTS</DefineConstants>
77
<IsPartialFacadeAssembly>true</IsPartialFacadeAssembly>
8-
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);netcoreapp3.0-windows;netcoreapp3.0-Unix;netcoreapp3.0</TargetFrameworks>
8+
<TargetFrameworks>$(NetCoreAppCurrent)-windows;$(NetCoreAppCurrent)-Unix;$(NetCoreAppCurrent);netcoreapp3.0-windows;netcoreapp3.0-Unix;netcoreapp3.0;net461;netstandard2.0</TargetFrameworks>
99
<ExcludeCurrentNetCoreAppFromPackage>true</ExcludeCurrentNetCoreAppFromPackage>
10-
<IncludeInternalObsoleteAttribute>true</IncludeInternalObsoleteAttribute>
1110
<Nullable>enable</Nullable>
1211
</PropertyGroup>
12+
<!-- DesignTimeBuild requires all the TargetFramework Derived Properties to not be present in the first property group. -->
1313
<PropertyGroup>
14-
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsAnyOS)' == 'true'">SR.SystemDrawingCommon_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
14+
<IncludeInternalObsoleteAttribute Condition="'$(TargetFramework)' != 'net461'">true</IncludeInternalObsoleteAttribute>
15+
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(TargetsAnyOS)' == 'true' and '$(TargetFramework)' != 'net461'">SR.SystemDrawingCommon_PlatformNotSupported</GeneratePlatformNotSupportedAssemblyMessage>
1516
</PropertyGroup>
1617
<ItemGroup Condition="'$(TargetsAnyOS)' != 'true'">
1718
<Compile Include="System\Drawing\Bitmap.cs" />
@@ -360,10 +361,8 @@
360361
<LogicalName>placeholder.ico</LogicalName>
361362
</EmbeddedResource>
362363
</ItemGroup>
363-
<ItemGroup>
364+
<ItemGroup Condition="'$(TargetFrameworkIdentifier)' == '.NETCoreApp'">
364365
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Win32.SystemEvents\src\Microsoft.Win32.SystemEvents.csproj" />
365-
</ItemGroup>
366-
<ItemGroup>
367366
<Reference Include="Microsoft.Win32.Primitives" />
368367
<Reference Include="System.Buffers" />
369368
<Reference Include="System.Collections" />

src/libraries/System.Drawing.Common/tests/System.Drawing.Common.Tests.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@
113113
</EmbeddedResource>
114114
</ItemGroup>
115115
<ItemGroup>
116+
<ProjectReference Include="..\src\System.Drawing.Common.csproj" />
116117
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Win32.SystemEvents\src\Microsoft.Win32.SystemEvents.csproj" />
117118
</ItemGroup>
118119
<ItemGroup Condition="$(TargetFramework.StartsWith('$(NetCoreAppCurrent)'))">
119120
<Compile Include="GraphicsTests.Core.cs" />
120121
<Compile Include="Graphics_GetContextTests.Core.cs" />
121122
<Compile Include="Drawing2D\MatrixTests.Core.cs" />
122-
<ProjectReference Include="..\src\System.Drawing.Common.csproj" />
123123
</ItemGroup>
124124
</Project>

0 commit comments

Comments
 (0)