过去的6个月中,我一直在开发Windows应用程序。该程序的工作方式与在其编程位置的笔记本电脑上应做的一样,但是我需要在另一台笔记本电脑上设置程序。我安装了相同的dotnet核心版本(3.0.100),并在同一目录(编译时)中将所有必需的DLLs启动了.exe。但是当我这样做时,我得到下面显示的错误。
[ERROR][1/23/2020 7:58:41 PM][Thread 0006][akka://ModulairVisionFramework/user/InterfaceCameraActor] Error while creating actor instance of type CameraSystem.InterfaceCameraActor with 0 args: ()
Cause: [akka://ModulairVisionFramework/user/InterfaceCameraActor#1923472091]: Akka.Actor.ActorInitializationException: Exception during creation
---> System.TypeLoadException: Error while creating actor instance of type CameraSystem.InterfaceCameraActor with 0 args: ()
---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.BadImageFormatException: Could not load file or assembly 'VimbaNET, Version=1.8.0.27270, Culture=neutral, PublicKeyToken=96b729f24f119b9a'. An attempt was made to load a program with an incorrect format.
File name: 'VimbaNET, Version=1.8.0.27270, Culture=neutral, PublicKeyToken=96b729f24f119b9a'
at CameraSystem.InterfaceCameraActor..ctor()
--- End of inner exception stack trace ---
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache)
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions)
at System.Activator.CreateInstance(Type type, Boolean nonPublic, Boolean wrapExceptions)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass109_0.<NewActor>b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
[INFO][1/23/2020 7:58:44 PM][Thread 0008][akka://ModulairVisionFramework/user/InterfaceCameraActor] Message Initialize from akka://ModulairVisionFramework/user/FrameworkActor to akka://ModulairVisionFramework/user/InterfaceCameraActor was not delivered. 1 dead letters encountered.
此错误System.BadImageFormatException: Could not load file or assembly
使我想到,我可能使用了错误的VimbaNET
DLL,但是我100%确信我使用了正确的DLL。如果我确实使用了错误的VimbaNET
DLL,那么我会得到与上述相同的错误,但是如果我使用正确的DLL,我也会得到该错误。我还尝试使用相同的IDE在新笔记本电脑上编译应用程序,但结果是相同的。
两台笔记本电脑都是64位的。
有人知道我可以解决这个问题吗?
我的应用程序的32位版本出现相同的错误。
程序集有关此问题的所有3个程序集的信息。
VimbaNET是导致问题的DLL
CameraSystem是我自己的使用VimbaNET的程序集
答案 0 :(得分:0)
安装 .NET 3.5 解决了这个问题,因为 Vimba SDK 依赖于 .NET 2(不,不是 .NET Standard 或 Core 2)(阅读 Vimba C# API 文档)。 .NET 3.5 包括 .NET 2 运行时。