SimConnect FileNotFoundException Despite All Troubleshooting

Hello,

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?

Thank you for your time and support.

Best regards,

Rabia

Hi Rabia,

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
 :slight_smile:

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).

Cheers,
-Max

As mentioned above
 here the dependencies I found for the MS24 SU02 Dev Kit

Runtime is Visual Studio 15
But needs some .Net System DLLs as well.
Hope it helps a bit

(derived with GitHub - lucasg/Dependencies: A rewrite of the old legacy software "depends.exe" in C# for Windows devs to troubleshoot dll load dependencies issues.)

@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.

  <ItemGroup>
    <ContentWithTargetPath Include="$(MSFS2024_SDK)\SimConnect SDK\lib\SimConnect.dll">
      <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
      <TargetPath>SimConnect.dll</TargetPath>
    </ContentWithTargetPath>
  </ItemGroup>

This DLL is not something you directly reference, you just need it copied to the same folder as your executable file.

This DLL is the one you ‘reference’ to get the ‘managed’ C# stuff.

When I say to add an existing item, I mean literally right click on your ‘project’ in the Solution Explorer and choose Add → Existing item:

Choose ‘All Files’ on the bottom right, navigate to wherever the SimConnect.dll is for your copy of the SDK and add it:

Then select it in your solution explorer list and change the ‘Copy to Output Directory’ property to ‘Copy Always’ or ‘Copy if Newer’

You can also directly edit the project file and add an entry like max points out above :slightly_smiling_face:

Thank you very much for your help, Max.

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. :blush:

1 Like

You’re very welcome. All working now? :slight_smile:

1 Like

Everything seems to be running smoothly for now. Hopefully, no new issues will pop up. :slightly_smiling_face:

It’s Simconnect. Issues will pop up. :upside_down_face:

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. :blush: