Bitmap Resources are crashing (partially) after changing a build machine. Could not load file or assembly System.Drawing.Common

0

Recently our build machine was migrated and after building same project on a new machine - one of the projects is crashing trying to load Bitmap from Resource file. Another project which is referencing same file - is loading it correctly.

What we have:

p1) Processing Project which is using those Bitmaps and is loading it from Resource file (located in same project). - .Net Standard 2.1

p2) Web Project - is using p1. And it works correctly. - .Net Core 3.1

p3) Azure Job - is using p1. It crashes runtime, when p1 is trying to load Bitmap from resource file. - .Net Core 3.1

Error message: Could not load file or assembly 'System.Drawing.Common, Version=4.0.2.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The located assembly's manifest definition does not match the assembly reference. (0x80131040)

Job p3 is already having a reference to Nuget package System.Drawing.Common (4.7) - is it possible to force ResourceReader to use that package instead of that default version 4.0.2.1? I think here is the main issue and possible solution, since my code which is using Bitmap from System.Drawing.Common 4.7 - is working perfectly, and then fetching a resource bitmap in next line is crashing with aforementioned exception.

Also I cannot understand why Web Project is not crashing in the same place.

c#
azure
.net-core
asked on Stack Overflow Feb 5, 2021 by John Constantine • edited Feb 5, 2021 by John Constantine

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0