I’ve quit trying to get Unity to work SimConnect, I can never get it working. I’ve started a C# WPF project, creating a basic SimConnect template that I can use for future projects so I don’t have write every line of code every single time.
It’s a simple project, a WPF window with two controls, a “test Connection” button, and an “Exit Application” button(I don’t really have code for Exit application yet). My code builds fine, and runs fine, but when I hit the “Test Connection” button(No matter whether I have MSFS running or not), I get this error:
System.BadImageFormatException: ‘Could not load file or assembly ‘Microsoft.FlightSimulator.SimConnect, Version=11.0.62651.3, Culture=neutral, PublicKeyToken=baf445ffb3a06b5c’. An attempt was made to load a program with an incorrect format.’
I’ve seen previous threads that say You need to put in Microsoft.FlightSimulator.Simconnect into the .exe folder. I’ve done that already, for both x64 and x86 architectures, but no luck.
Would appreciate a bit of help, thanks!
edit: How did I make some of the text larger and the other text normal? The only text I copied was the visual studio error lol
** VERY IMPORTANT** the SimConnect.dll is 64-bit! If you’re planning on creating projects yourself, make sure your project is also configured to compile in 64-bit
I have read your thread a couple of times and it is very helpful. However I went into Project Properties and set platform target ->x64 bit but that still didn’t help.
Just read the part where it says “If you’re using a development IDE such as Visual Studio, the SimConnect.dll may not automatically copy to your compiled output folder, you may have to force it or do that manually.” Where do I go to set this?
Another common problem. The easiest way to fix this is to use a Post Build script to copy the missing DLL and associated CFG file into your output folder.
Unfortunately I’m not near my computers, otherwise I’d post a screenshot or 2, let me know if you’re still stuck and I’ll do that for you when I get back