How to avoid 'Unable to load DLL' scenarios <p>I'm trying to build a game using Monogame. Monogame uses its own bunch of DLLs. However inside one of those DLLs is a dependency on another DLL (which could potentially not exist as it was not installed).</p> <p>More specifically when trying to utilize a method/class of Monogame's DLLs</p> <pre><code>GamePad.GetState(PlayerIndex.One).Buttons.Back </code></pre> <p>This error is produced:</p> <blockquote> <p>Unable to load DLL 'xinput1_3.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)</p> </blockquote> <p>The fix for this error isn't difficult. The user needs to install the correct system requirements.</p> <p>How do I tell this to the user from the front end? My aim is to inform the user that 'Gamepad controllers are disabled for this because xxx is not installed on your system', while carrying on running the game - as gamepads are optional.</p> <p>Is there a way I could have caught this issue (i.e. is there a way I could have checked to see if this DLL exists - without being very specific of its location/filepath) before attempting to utilize the method/class?</p> <p>Is having a <code>try-catch</code> block around the whole application the best approach?</p> <p>Are there better ways to handling the (common?) 'Unable to load DLL' cases?</p> <p>My main goal is to ignore any DLL dependency issues as I plan to distribute this game without installers. Plus any missing non-game-breaking DLLs should just be ignored.</p>