System.Drawing.Common and LogDisplay load errors
See original GitHub issueUnder .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.
Issue Analytics
- State:
- Created 7 months ago
- Comments:16 (8 by maintainers)
Top Results From Across the Web
System.Drawing.Common assembly not loading
im using dotnet 6 and in dotnet 6 the Bitmap package was moved to a download only package, no problem here, I just...
Read more >System.Drawing.Common only supported on Windows - .NET
Learn about the .NET 6 breaking change where the System.Drawing.Common package is no longer supported on non-Windows operating systems.
Read more >Why am I getting this error about System.Drawing? : r/csharp
I am trying to do stuff with images in C# (basically saving into an image file) and every solution to that that I've...
Read more >Package System.Drawing.Common 6.0.0 is not compatible ...
I've been trying to write a small application that works with some bitmap images. The way this works was changed by Microsoft not...
Read more >Oracle Primavera Submittal Exchange Design Team User ...
How to Upload or Change Your Company's Logo on the Submittal Exchange ... Log Display Options . ... Common Categories: Drawings, Specifications, Addenda....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yay!
I ran into this as well; unfortunately, i was unable to remove the intermediate dependency that was introducing
System.Drawing.Common
(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: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.