Reputation: 389
I'm copying my program to a Virtual Machine to see what software I need and which settings I need to have enabled (or disabled). My program is running fine on my work laptop and on my own laptop (older version), but on the VM the program throws an error during run time.
My program is made out of one executable and many DLLs, both the Executable and the DLLs are able to start just fine including using the dependency system.drawing.common
. But one of the classes in one of the DLLs gives an error that the dependency system.drawing.common
could not be loaded. Rebuilding the DLL in question doesn't give a warning that something is wrong. See image below for the error I see.
[ERROR][12/18/2019 11:04:02 AM][Thread 0006]> [akka://ModulairVisionFramework/user/AcquireImageActor] Could not load file ? or assembly 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, >PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. Cause: System.IO.FileNotFoundException: Could not load file or assembly >'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, >PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified. File name: 'System.Drawing.Common, Version=4.0.2.0, Culture=neutral, >PublicKeyToken=cc7b13ffcd2ddd51' at CameraSystem.Actors.AcquireImageActor.<.ctor>b__2_0(AcquireImage resp) at lambda_method(Closure , Object , Action
1 ) at Akka.Tools.MatchHandler.PartialHandlerArgumentsCapture
2.Handle(T >value) at Akka.Actor.ReceiveActor.ExecutePartialMessageHandler(Object message, >PartialAction`1 partialAction) at Akka.Actor.ReceiveActor.OnReceive(Object message) at Akka.Actor.UntypedActor.Receive(Object message) at Akka.Actor.ActorBase.AroundReceive(Receive receive, Object message) at Akka.Actor.ActorCell.ReceiveMessage(Object message) at Akka.Actor.ActorCell.Invoke(Envelope envelope)
What can the cause be that the main executable and the interface of the DLL are both using system.drawing.common
fine, but a class in the DLL in question cannot use the dependency? And how can this issue be resolved? I have not faced this issue on my work laptop so far or on another computer (older version of my application but still uses system.drawing.common
).
EDIT
In both the executable project as in the DLL in question I'm using the NuGet package manager for system.drawing.common
. How the package is included:
<PackageReference Include="system.drawing.common" Version="4.6.0" />
Upvotes: 1
Views: 3504
Reputation: 5603
I hit this same problem a week or so ago. If this is a .NET core assembly, the way you reference it makes a big difference. Instead of referencing the .NET lib directly (right click -> add reference), use a package reference in the project file:
<PackageReference Include="System.Drawing.Common" Version="4.6.0" />
Upvotes: 1