none
How can I deploy my native DLLs with my Metro app?

    Question

  • Hello,

    I am trying to get my metro style (or is it called Win 8 style now?) WinRT application run correctly, and I have an issue with native DLLs I use: I looks for the necessary DLLs in the $(TargetDir)AppX folder. If they are there, the program runs smoothly. If the DLLs are somewhere else, it cannot find them, not even at those "hardcore" places like Windows\System32.. Now, this directory is created after the first run of the program from when it does crash due to missing DLLs, and also I cannot copy here in a custom build step, because the first deployment seems to delete this directory. I think (please confirm) this whole thing is a deployment issue.

    The only stuff that tries to solve deployment - and not tries to trick with custom build steps, what does not seem to work - I have found about this is this thread. Unfortunately, it is for VS2012 Development Preview / beta, and does not help with VS2012 RTM: there is no "Enable Tailored Feature" switch, or anything similar anywhere, and just adding the DLLs to the executable's project, and setting "content" to true doesn't do the trick, the files are not appearing anywhere. It does however work with a data file, so it seems to me DLLs are excluded on purpose or packing..

    These DLLs have been compiled with WINAPI_FAMILY_APP define, and linked with /APPSTORE switch (not sure if /APPSTORE is needed though).

    How can I make the needed DLLs appear in the AppX folder?
    Tuesday, October 23, 2012 1:34 PM

Answers

  • Right click on your project solution explorer and go Add -> Existing item -> add dll from your desired directory.

    Right click on your dll file and set Content = Yes.

    See whether your dll is available or not in Appx directory under debug/release folder. It will be automatically copied in Appx .
    Monday, November 05, 2012 4:31 AM

All replies

  • Right click on your project solution explorer and go Add -> Existing item -> add dll from your desired directory.

    Right click on your dll file and set Content = Yes.


    Tuesday, October 23, 2012 4:01 PM
  • Wednesday, October 24, 2012 12:44 AM
  • As I wrote in the original port, that is not working, the DLL does not appear in AppX.

    Although, the Item Type there is "Does not participate in build". Is that normal?

    Wednesday, October 24, 2012 8:15 AM
  • I believe you need to set 'Content' value to 'Yes' for this file. At least it works for me in this way:)

    --Vladimir


    Wednesday, October 24, 2012 1:10 PM
  • OK, I made it work with the content=true way. There is some voodoo about where the DLLs are. It seems it is only working if the DLLs are added to the project of the executable (and not to a library it is actually using), and placed next to the .vcxproj file. If they are added elsewhere, it seems that they appear somewhere else the exe cannot find during executing.
    Thursday, November 01, 2012 2:46 PM
  • Right click on your project solution explorer and go Add -> Existing item -> add dll from your desired directory.

    Right click on your dll file and set Content = Yes.

    See whether your dll is available or not in Appx directory under debug/release folder. It will be automatically copied in Appx .
    Monday, November 05, 2012 4:31 AM
  • I don't know if this helps you, but I've had similar experiences with trying to get more 'unusual' file types to appear in the AppX package. 

    There seems to be different behaviour for ARM vs. Win32 builds.  For example, if I have a PDF file and I mark it as 'Content = Yes', it will appear in the AppX for the Win32 build but does NOT appear when deployed on the ARM device.  To make it appear in the ARM AppX package I also have to change its 'Item Type' to 'Media'.

    Without trying to sound like a moan, I do feel that the current resource building system is pretty clunky and it's very easy to end up with the odd missing file or two in the ARM package which goes undetected unless every part of the app is tested extensively every time a resource is changed.  I've been trying to find a way to just recursively copy my entire resource directory to the package and so far have failed.  I'm now considering building all my resources into a single 'archive' file lump and then writing a custom file system to deliver files from that archive at run time.  This way, the only resource copy error that will occur will be all or nothing, and thus very easy to detect when testing.

    Wednesday, November 14, 2012 4:32 PM