locked
Import Win32 DLL in Windows Store App

    Question

  • Hi,

    I am trying to using Win32 DLL in my Windows Store App (Build using C#/XAML). I follow this article and created a Win32 DLL,, then I imported the DLL into my Windows Store App, and its working till the time I run it in my PC (Dell Laptop, Windows 8.1 OS). But then I deploy the same app into a Tablet (Dell Venue Pro 8, Windows 8.1 OS) it says the below error :

    An exception of type 'System.DllNotFoundException' occurred in WiFiDllTest2.exe but was not handled in user code
    
    Additional information: Unable to load DLL 'MathFuncDll.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)

    Just to double check I have also created the application package file and then installed the app using Windows Power Shell. The same issue, works on my laptop but no on Tablet.

    Please suggest me.

    Thanks

    Somnath

    Sunday, April 12, 2015 1:08 PM

Answers

  • You will need to make sure the dependency DLLs are included in the appx package.

    That is the only way to ensure they are copied and available in production.

    Tuesday, April 14, 2015 6:11 AM
    Owner

All replies

  • Hello Somnath,

    have you checked for platform-compartibility?

    If you deploy the app (Win32-DLL) as x86, for example, it migth not run as expected. You should compare the Versions of the OSes on the Tablets (Is It Windows 8 or Windows RT? x64 or x86?)


    © 2015 Thomas Roskop

    Germany // Deutschland

    Sunday, April 12, 2015 1:27 PM
  • Here is the details of the Tablet: 

    1. OS : Windows 8.1 Single Language With Bing

    2. Processor : Intel Atom

    3. System Type : 32-bit operating system, x64-based processor

    Here is the Link

    The oply difference with my laptop is that my laptop has 64-bit OS and in Tablet 32-bit OS

    Sunday, April 12, 2015 1:41 PM
  • How did you import it into your project?

    DllNotFoundException sounds like it is not correctly included in the appx package and deployed with the app. Without being deployed it's not there to be called.

    Make sure the DLL is in the project and marked as content, then double check that when you build the appx it is included in the APPX file. If it's in the Appx directory (and you didn't copy it there manually) then it will probably be fine, but you can double check when you create the appx package file by renaming the appx to .zip and examining its contents.

    Sunday, April 12, 2015 11:17 PM
    Owner
  • How did you import it into your project?

    DllNotFoundException sounds like it is not correctly included in the appx package and deployed with the app. Without being deployed it's not there to be called.

    Make sure the DLL is in the project and marked as content, then double check that when you build the appx it is included in the APPX file. If it's in the Appx directory (and you didn't copy it there manually) then it will probably be fine, but you can double check when you create the appx package file by renaming the appx to .zip and examining its contents.

    I have performed the following steps:

    1. Clean and Build my app in both Debug and Release mode. In both case the DLL is getting adding in the APPX directory.

    2. I created a Package File and once the .appx file got genetated I renamed to .zip and extract the content. The DLL does present there.

    3. Then I install the package file using Windows powershell and through VS on my laptop (Windows 8.1 OS)- its working fine.

    4. I tried to remote debug and copied the package file to my tablet. Its NOT working.

    Monday, April 13, 2015 4:57 AM
  • Thanks guys,

    It was because of the Dependency DLL, I copied the Dependency DLL to my tablet and everything worked  fine.

    Regards

    Somnath

    Monday, April 13, 2015 10:37 AM
  • You will need to make sure the dependency DLLs are included in the appx package.

    That is the only way to ensure they are copied and available in production.

    Tuesday, April 14, 2015 6:11 AM
    Owner