System.Drawing.Common and LogDisplay load errorsSee original GitHub issue
Under .NET 6 add-ins, the LogDisplay may fail to load with an error complaining about a set_Font method not found. This relates to a newer version of the assembly System.Drawing.Common being present in the output directory. There is a deep .NET 6 mess related to this file, and why it might be present after referencing some packages. See for example https://github.com/dotnet/runtime/issues/64592
If using the System.Configuration.ConfigurationManager it might help to reference version 6.0.0 instead of 6.0.1.
Otherwise, the file can be explicitly deleted in the build:
<Target Name="RemoveSystemDrawingCommon" AfterTargets="ResolveAssemblyReferences"> <ItemGroup> <ReferencePath Remove="@(ReferencePath)" Condition="%(ReferencePath.NuGetPackageId) == 'System.Drawing.Common'" /> </ItemGroup> </Target>
Is this safe? Presumably not always.
- Created 7 months ago
- Comments:16 (8 by maintainers)
Top GitHub Comments
I ran into this as well; unfortunately, i was unable to remove the intermediate dependency that was introducing
NetMQ, in my case). I found that while the Target in this (and the linked) issue didn’t prevent the dll being copied into my output dir, the following did:
<Target Name="RemoveSystemDrawingCommon" AfterTargets="ResolveAssemblyReferences"> <ItemGroup> <ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" Condition="%(ReferenceCopyLocalPaths.NuGetPackageId) == 'System.Drawing.Common'" /> </ItemGroup> </Target>
From my reading of the linked issue, this seems to be a valid fix, although this is as you say a bit of a .net mess.