I am developing an application using the Microsoft Flight Simulator SimConnect SDK to retrieve live flight data. My goal is to use this data (altitude, airspeed, pitch, bank, etc.) to drive a motion simulator, creating a more immersive and realistic flight experience. However, I am currently unable to start my project because I am receiving a System.IO.FileNotFoundException when trying to connect to SimConnect.
The exact error message is:
System.IO.FileNotFoundException: 'Could not load file or assembly 'Microsoft.FlightSimulator.SimConnect.dll' or one of its dependencies. The specified module could not be found.'
I have already taken the following troubleshooting steps:
Verified File Paths: I have confirmed that both Microsoft.FlightSimulator.SimConnect.dll and SimConnect.dll are correctly located in my projectâs output directory (bin/x64/Debug).
Checked Platform Configuration: My project is configured to build for the x64 platform, which matches the architecture of the SimConnect DLLs.
Installed Dependencies: I have downloaded and installed the Visual C++ Redistributable for Visual Studio 2015-2022 for both x86 and x64 architectures.
Followed Application Flow: I am running my application only after launching Microsoft Flight Simulator and entering a free flight session in the cockpit.
Since my project relies on successfully receiving flight data, resolving this error is critical. Despite my best efforts, the issue persists, leading me to believe that it may be caused by a secondary dependency or a specific system configuration that is not addressed by standard troubleshooting steps.
Could you please provide some guidance on what might be causing this error and what additional steps I can take to resolve it?
Your report is nice and detailed, but you donât mention which .NET version youâre using. Actually Iâm even assuming youâre using .NET (C# or VB) just based on the error messageâŠ
At this point not sure what else the issue may be besides a potential .NET version mismatch.
You could also try loading the various DLLs into a âdependency walkerâ type program (thereâs a depends.exe which is included with some older Windows SDKs/Debug Tools, and some 3rd party apps like https://github.com/lucasg/Dependencies, for example).
@daisyll9377
The problem almost certainly is that the main simconnect.dll is NOT automatically imported. You need to âadd existing itemâ to your VS solution, select the simconnect.dll and then set it to âalways copyâ in the properties panel for your VS solution.
When you add the reference that only imports the managed dll (Microsoft.FlightSimulator.Simconnect.dll), but that has a sub-dependency on the original simconnect.dll
Thank you for your assistance. When I attempt to use âAdd Existing Itemâ, I cannot find the SimConnect.dll file in the specified directory, so I am unable to add it to the project. Additionally, when I try to add the SimConnect.dll file through âAdd Referenceâ, I encounter the following error: A reference to âC:\MSFS 2024 SDK\SimConnect SDK\lib\SimConnect.dllâ could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
You indicated that SimConnect.dll was already in your build directory. If that is also where your actual executable is placed (and running from), then thatâs all that is needed. If itâs not actually there, or if it is the wrong version, then youâd definitely see that error. It is important the DLL is actually from the MSFS SDK being used, not some random one.
Hereâs a CS project file entry for copying over the SimConnect.dll automatically into the build directory. $(MSFS2024_SDK) is an environment variable that should have been created when the FS24 SDK is installed, or you can replace that with a hard-coded path.
Thank you so much for your help! The screenshots were incredibly clear and made it easy to understand. I really appreciate you taking the time to explain it so well.
I dearly hope some day we will get a new modernised and flexible interface, but for now we live with SimConnect.
You said your goal was to drive a motion simulator though, so I assume you just need to read a bank of simvars and thatâd be the end of it. Once you understand how to subscribe to the vars and process the data, and which vars you needed⊠that at least should be smooth.
Youâre right, I hope we can use a more advanced SimConnect interface in the future. For now, it seems weâll have to make the best of what we have. Your guidance on reading the necessary simvars to control the simulatorâs motion was very helpful. As long as I can process this data correctly, I should be able to handle this part without issue. Thank you for your help.