locked
Is there a better way to package dll's built in the solution?

    Question

  • I have some dlls used by the metro style application. These dlls are built in the same solution and output directory differs by the configuration. I put them into package by

    1. copy them to some fixed place after dll build by dll projects.
    2. build dll projects once to place them
    3. add binary in fixed place to application project and configure CopyToOutputDirectory

    I think this approach is not straightforward. Is there a better way?

    Thursday, March 01, 2012 9:37 AM

Answers

  • If these dlls are not metro style dlls (classic dlls), you need to set General -> "Support Metro Style Application" to "true" on the property page for the output of the projects to be packaged. Also, once the dlls are packaged, you can find them in the appx file (you can change the .appx extension to .zip to view the content of the zip file).

    Li Shao, MSFT


    Li Shao

    Monday, March 12, 2012 9:43 PM

All replies

  • Hi Yoichi,

    If you metro application references these dlls, these dlls should be automatically packaged. Is that not the case for you?

    Thanks,

    Li Shao, MSFT


    Li Shao

    • Proposed as answer by Jesse Jiang Friday, March 02, 2012 2:45 AM
    Thursday, March 01, 2012 6:50 PM
  • Thank you. Yes, for .NET class library or Windows Runtime Component, adding reference in application project works well. But my question is not the case.

    I'm talking about dlls without metadata, and be linked via import libraries or be loaded by LoadPackagedLibrary.


    Friday, March 02, 2012 3:31 AM
  • If you add reference from you metro app to the projects that producing these dlls, these dlls should be packaged.

    Or you can add these dlls to your metro project as project items, make them as "content" of the project. You can set project items as content by setting the "content" property to "true" in the properties window. 

    Li Shao, MSFT


    Li Shao

    Friday, March 02, 2012 5:22 AM
  • When I add reference from metro app project to non-winrt dll project, warning dialog pop-up. I proceed and reference is added. But dll will not be packaged.

    Friday, March 02, 2012 7:39 AM
  • Sorry for the delay. Did you do "Project to project" reference: add reference from you metro app to the projects that producing these dlls?

    Li Shao, MSFT


    Li Shao

    Thursday, March 08, 2012 9:27 PM
  • I did as follows(I'm using VS11 beta on Windows8 CP):

    1. In solution explorer, right click the application project and select "References..." in the menu
    2. Click "Add New Reference..." button and select native dll project file.
    3. In property page, "Full Path" under "Reference Properties" point to static library (import library created by dll project). Is It OK?
    4. Execute binary from Visual Studio, then it fails to run since dependent dll cannot be loaded.
    5. dll is not found in $(Configuration)\AppX\


    Monday, March 12, 2012 5:25 AM
  • If these dlls are not metro style dlls (classic dlls), you need to set General -> "Support Metro Style Application" to "true" on the property page for the output of the projects to be packaged. Also, once the dlls are packaged, you can find them in the appx file (you can change the .appx extension to .zip to view the content of the zip file).

    Li Shao, MSFT


    Li Shao

    Monday, March 12, 2012 9:43 PM
  • It works. Thanks!

    When I set "Metro Style App Support" in dll project, use of precompiled header is also changed (I think this is because default value is used). By selecting "Not Using Precompiled Headers", it come back to compile again. Then I add reference from application project to dll project, warning dialog does not pop-up, and Full Path point to winmd file. Finally I have dll&winmd in the package.



    Tuesday, March 13, 2012 5:53 AM