0

I am using Microsoft Windows API Code Pack DirectX to determine a users graphics card memory. The DLL needs to be run on either an x64 or an x86 platform, not AnyCPU. Testing the application on computers with Visual Studio (VS) installed the application correctly uses the DLL and I can import the namespace; however, on a computer where I did not have VS installed it gave the following error:

"Unhandled Exception: System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.WindowsAPICodePack.DirectX.dll' or one of its dependencies. The specified module could not be found. at Application.Module1.Main()"

Then I installed VS on that machine to try and Debug the error and then the program worked, but I then uninstalled VS and the program started giving out that error again. This error was on the x64 platform, then I tried using the x86 platform, to realize that using 32 bit with dedicated memory returns wrong answers because of duplication. My Local Copy is set to True in my Reference, the application is on the .NET Framework 4.7.2, and all the machines the application has been tested on have been 64-bit.

Imports Microsoft.WindowsAPICodePack.DirectX.Graphics

Module Module1

Private videomemory As String

Sub Main()
Dim factory As Factory1 = Factory1.Create()

For Each adapter As Adapter1 In factory.Adapters
Dim description As AdapterDescription = adapter.Description
videomemory = description.DedicatedVideoMemory     
Next adapter

The results with VS installed on a 64-bit system using the x64 application platform for a 4gb GPU the dedicated memory was, 4213178368. Then with VS installed on a 64-bit system using x86 application platform with the same GPU, the dedicated memory was 3221225472. Again on the 64-bit machine without VS installed using the x64 platform the error occurred and when switched to an x86 application platform the application worked (recognized the DLL). I suspect this is because when VS is installed the DLL needs something offered from VS, hence why it breaks without VS and whatever the x86 DLL needs is different than the x64 DLL. I do not know what the DLL needs, looking into the source code it only uses mscorlib.dll, system.dll, system.core.dll, D2dl.dll, D3d11.dll, D310.dll, D310_1.dll, DXGI.dll, and DWrite.dll Also, the DLL uses a v4.0.30319 runtime. Somethings I attempted because I am sure the computer is missing or not finding a dependency are: reinstalling windows, downloading the DirectX Web Installer, and re-registering all of my DLL's. Unfortunately, none of those work so it has to be a source (dependency) coming from VS.

The DLL can be found here: https://www.nuget.org/packages/WindowsAPICodePack-DirectX/

The source code can be found here: https://github.com/aybe/Windows-API-Code-Pack-1.1

0 Answers0