Skip to content

System.Drawing.Common is manifested differently in SDK and Runtime NuGet #5405

@mediawolf

Description

@mediawolf

Description

The profile of System.Drawing.Common is manifested inconsistently - WindowsForm;WPF vs WindowsForms:

From C:\Program Files\dotnet\packs\Microsoft.WindowsDesktop.App.Ref\10.0.0\data\FrameworkList.xml:

...
<File Type="Managed" Path="ref/net10.0/System.DirectoryServices.dll" AssemblyName="System.DirectoryServices" PublicKeyToken="b03f5f7f11d50a3a" AssemblyVersion="10.0.0.0" FileVersion="10.0.25.52411" Profile="WindowsForms;WPF" />
<File Type="Managed" Path="ref/net10.0/System.Drawing.Common.dll" AssemblyName="System.Drawing.Common" PublicKeyToken="cc7b13ffcd2ddd51" AssemblyVersion="10.0.0.0" FileVersion="10.0.25.52411" Profile="WindowsForms;WPF" />
...

From C:\Users\polischuk\.nuget\packages\microsoft.windowsdesktop.app.runtime.win-x64\10.0.0\data\RuntimeList.xml:

...
<File Type="Managed" Path="runtimes/win-x64/lib/net10.0/System.DirectoryServices.dll" AssemblyName="System.DirectoryServices" PublicKeyToken="b03f5f7f11d50a3a" AssemblyVersion="10.0.0.0" FileVersion="10.0.25.52411" Profile="WindowsForms;WPF" />
<File Type="Managed" Path="runtimes/win-x64/lib/net10.0/System.Drawing.Common.dll" AssemblyName="System.Drawing.Common" PublicKeyToken="cc7b13ffcd2ddd51" AssemblyVersion="10.0.0.0" FileVersion="10.0.25.52411" Profile="WindowsForms" />
...

I've included System.DirectoryServices.dll as an example of a consistent declaration.

Reproduction Steps

When I build my WPF project:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net10.0-windows</TargetFramework>
    <UseWPF>true</UseWPF>
    <PublishSelfContained>true</PublishSelfContained>
    <SelfContained>true</SelfContained>
  </PropertyGroup>
...

Expected behavior

The declarations in SDK and relevant NuGet packages are consistent.
Any expected inconsistency should be documented.

Actual behavior

System.Drawing.Common.dll is not copied to the output directory.

If I change the profile inside RuntimeList.xml from WindowsForms to WindowsForms;WPF, then that DLL will be copied as I would expect.

Regression?

Worked in .NET 8.0, where such profiles didn't exist yet.

Known Workarounds

DOESN'T WORK:

  • Having an explicit reference inside the project: <PackageReference Include="System.Drawing.Common" />.
  • Having both <UseWindowsForms>true</UseWindowsForms> and <UseWPF>true</UseWPF> defined - not supported combination.

Configuration

No response

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions