Error loading c# dll clientside System.BadImageFormatException

Helllo,

i try to create a clientside c# script. Compiling works fine with Net Framework 4.5.2 like description.

The problem is after connection to the server i get an error:

Could not load assembly TestClient.net - loading exceptions: Exception loading assembly TestClient.net: System.BadImageFormatException:

[ 23812] [ GTAProcess] MainThrd/ at (wrapper managed-to-native) System.AppDomain:LoadAssemblyRaw (System.AppDomain,byte[],byte[],System.Security.Policy.Evidence,bool)

[ 23812] [ GTAProcess] MainThrd/ at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence, System.Boolean refonly) [0x0000e] in <74fbbe963b7e417b8d715b858c5c584f>:0

[ 23812] [ GTAProcess] MainThrd/ at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore, System.Security.Policy.Evidence securityEvidence) [0x00000] in <74fbbe963b7e417b8d715b858c5c584f>:0

[ 23812] [ GTAProcess] MainThrd/ at (wrapper remoting-invoke-with-check) System.AppDomain:Load (byte[],byte[],System.Security.Policy.Evidence)

[ 23812] [ GTAProcess] MainThrd/ at System.AppDomain.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore) [0x00000] in <74fbbe963b7e417b8d715b858c5c584f>:0

[ 23812] [ GTAProcess] MainThrd/ at (wrapper remoting-invoke-with-check) System.AppDomain:Load (byte[],byte[])

[ 23812] [ GTAProcess] MainThrd/ at System.Reflection.Assembly.Load (System.Byte[] rawAssembly, System.Byte[] rawSymbolStore) [0x00005] in <74fbbe963b7e417b8d715b858c5c584f>:0

[ 23812] [ GTAProcess] MainThrd/ at CitizenFX.Core.InternalManager.CreateAssemblyInternal (System.String assemblyFile, System.Byte[] assemblyData, System.Byte[] symbolData) [0x0003c] in C:\gl\builds\master\fivem\code\client\clrcore\InternalManager.cs:123

[ 23812] [ GTAProcess] MainThrd/ at CitizenFX.Core.InternalManager.LoadAssemblyInternal (System.String baseName, System.Boolean useSearchPaths) [0x00177] in C:\gl\builds\master\fivem\code\client\clrcore\InternalManager.cs:245

I use the latest fivem client resource.
Included packages:

  • Castle.Core 4.2.0
  • Newtonsoft.Json 12.0.2
  • Ninject 3.3.4
  • Ninject.Extensions.Conventions 3.3.0
  • Ninject.Extensions.Factory 3.3.2

My fxmanifest looks like:

file 'Castle.Core.dll'
file 'Newtonsoft.Json.dll'
file 'Ninject.dll'
file 'Ninject.Extensions.Conventions.dll'
file 'Ninject.Extensions.Factory.dll'

client_script 'TestClient.net.dll'

I think my resource cant resolve the other dlls. But why? they are for 4.5.2.

Hope for help :slight_smile:

Thanks :slight_smile: