locked
How to deploy my dlls with the Metro sytle app

    Question

  • I have several C++ dlls I am using in a metro style app (directx). But it looks like these dlls are not copied to AppxLayouts folder with the executable. Packaging doesn't contain my dlls either. If I manually copy my dlls, everything seems to work.

    How can I add my dll project (they are part of the solution and executable references them) to the deployment list?

    I am using visual studio ultimate.


    Orhun Birsoy
    Saturday, September 24, 2011 6:26 PM

Answers

  • Hi Orhun,

    Could you try the following:

    1. set "General" -> "Enable Tailored Feature" to "yes" in the property page for Win32 dll project

    2. Add referece to the dll project in your DirectX project

    3. Packaging

    You should see win32 dll being added to the package. Please let me know if this works for you.

    Li Shao, MSFT

     


    Li Shao
    • Marked as answer by OrhunB Tuesday, September 27, 2011 4:41 PM
    Monday, September 26, 2011 5:40 PM

All replies

  • Hi Orhun,

    Are the DLLs being produced as the output of some projects inside your solution?  If yes, then in your main application project, add references to all the projects whose outputs you want to include in your final package.

    If these are just loose DLLs then you need to add them to your main app project (Right click project -> add existing files).  However, most likely you will need to recompile these DLLs with the SDK for Meto style apps.  For that, you will need some kind of projects for these DLLs anyway.

    Thanks

    Raman Sharma

    Program Manager, Visual C++

    Monday, September 26, 2011 1:18 AM
  • Hi,

    You should be able to add the DLL to your solution. Then on the properties of the dll mark Content=True. This should make the DLL not part of the package. Thus making it available in AppxLayouts and the appx package.

    The other alternative is to add these DLL as file references to the packaging project (Metro app).

     

    Let me know if this helps.

    Jay Shrestha (MSFT)

    Monday, September 26, 2011 2:31 PM
    Moderator
  • My dll projects are part of the solution. I have upgraded them from Visual Studio 2010 (they are 2011 projects now). They are 'normal' C++ Win32 dlls. I am quite sure they don't use anything WinRT doesn't like (after all if I copy the dlls manually, my metro style directx app works. By the way, is this assumption correct?). 

    I already have these dlls in References. (i.e. in MetroApp1 property pages->Common Properties->Framework and References).

    Is there any other type of reference I should add these dlls to?

    Perhaps it is related to how I created this solution.

    1. Create a blank solution.
    2. Add win32 dll projects (and upgrade)
    3. Add new MetroApp1 directx project.
    4. Add references to the dlls and start using them :)
    Thanks.


    Orhun Birsoy
    Monday, September 26, 2011 3:51 PM
  • My dll projects are part of the solution. I have upgraded them from Visual Studio 2010 (they are 2011 projects now). They are 'normal' C++ Win32 dlls. I am quite sure they don't use anything WinRT doesn't like (after all if I copy the dlls manually, my metro style directx app works. By the way, is this assumption correct?).
     
    I already have these dlls in References. (i.e. in MetroApp1 property pages->Common Properties->Framework and References).
    I'm not sure that adding a reference to a Win32 DLL is the thing to do. Normally, I just create a project dependency and tell the linker to link dependent projects automatically. Are you saying that this does not work for a WinRT application project?
     
    If not, can you not change the output directory for your DLL project, or add a post-build event to copy the DLL to the desired location?
     

    David Wilkinson | Visual C++ MVP
    Monday, September 26, 2011 4:21 PM
  • I'm not sure that adding a reference to a Win32 DLL is the thing to do. Normally, I just create a project dependency and tell the linker to link dependent projects automatically. Are you saying that this does not work for a WinRT application project?

    I have been using "Framework and References" since Visual Studio 2010 for all my native and managed projects for all kinds of different and mixed solutions. I like it, since it works the same for all the different type of projects I work with. I haven't tried "right click-> project dependencies" method, since it's been a while I used that even for 'normal' C++ native projects in Visual Studio 2010.

    If not, can you not change the output directory for your DLL project, or add a post-build event to copy the DLL to the desired location?
    Sure I can change all that but,
    1. "C:\Users\orhunbirsoy\AppxLayouts\7db47563-5fae-4f7d-929e-0624a3204fe8VS.Debug.x64.orhunbirsoy" directory is something Visual Studio 2011 (and/or WinRT and/or Windows 8) requires so I think Visual studio should handle where all my required dlls should go.
    2. When I package(deploy?) my Metro app, the package (a zip file) doesn't contain my dlls either. So I have to some up with a manually add my dlls to this package(i.e MetroApp1_1.0.0.1_x64_Debug.appx) myself. By manual I mean some kind of post-build/deploy step. I rather convert my projects to static libs instead, which I can do for the protype I am working on.

    Orhun Birsoy
    Monday, September 26, 2011 5:21 PM
  • Hi Orhun,

    Could you try the following:

    1. set "General" -> "Enable Tailored Feature" to "yes" in the property page for Win32 dll project

    2. Add referece to the dll project in your DirectX project

    3. Packaging

    You should see win32 dll being added to the package. Please let me know if this works for you.

    Li Shao, MSFT

     


    Li Shao
    • Marked as answer by OrhunB Tuesday, September 27, 2011 4:41 PM
    Monday, September 26, 2011 5:40 PM
  • This kind of works (i.e. the dll copied to the appxlayouts).

    But I get unresolved external symbols for all functions I use from the dll. Dll exports the functions I need (checked with Dependency Walker), but somehow linker cannot find them. I use _declspec(dllexport) to export. 

    If I use "Enable Tailored Feature" do I need to use WinRT objects? I don't need my dlls usable from other languages. This is a C++ application using C++ dlls.

    Thanks.

     

     


    Orhun Birsoy
    Tuesday, September 27, 2011 3:38 PM
  • Do you see the exported lib file being passed to the linker command line? That might be a bug on our side.

    When "Enable Tailored Feature" is on, you may consume any types in your orginal dll that is available for modern SDKs.

    Li Shao, MSFT


    Li Shao
    Tuesday, September 27, 2011 4:18 PM
  • You are right. Command line does not contain the lib file if "Enable Tailored Feature" is on. When it is off it, the lib is listed on the command line.

    Is Microsoft Connect the correct place to report this bugs for this developer preview as well?

    Thanks.

     


    Orhun Birsoy
    Tuesday, September 27, 2011 4:41 PM
  • Yes, in general, Microsoft Connect is the right place to report this kind of issue. For this particular issue, we already have an internal bug on this. You are welcome to open another bug. Alternatively, you can send me a simple repro and I will make sure your issue is fixed.

    Li Shao, MSFT


    Li Shao
    Tuesday, September 27, 2011 4:58 PM
  • My email is lishao AT microsoft dot com.

    Li Shao, MSFT


    Li Shao
    Tuesday, September 27, 2011 7:46 PM