Visual C++ Static library does not allow "Metro Style App Support" RRS feed

  • Question

  • I started an empty project as follows:

    Installed / Templates / Visual C++ / Blank Static Library

    It builds fine.

    Then under Project Properties, I choose:

    Configuration Properties / General / [left panel]

       Project Defaults [right panel]

        Metro Style App support to Yes.  (Last line on right panel)

    I left "Configuration Type" as Static Library (.lib), the original setting.

    I try to build the project. I get this error message:

    1>C:\Program Files\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.CppBuild.targets(334,5): error MSB8016: This project does not support the current Configuration Type (StaticLibrary).

    I need to build my existing library in static mode, otherwise it needs a good amount of changes in my build.

    From my static build I need to access Metro App code like this, for which I thought I need Metro Style App support.

    using namespace Windows::Networking::Sockets;
    void foo()
        StreamSocket^ socket = ref new StreamSocket();

    Please advise. Any other ways to accomplish my goal?

    Thursday, April 26, 2012 6:19 PM

All replies

  • Hello,

    Thanks for your feedback, I found a same issue in connect

    You can try the temporary solution.

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Friday, April 27, 2012 8:43 AM
  • Hi Jesse,

    I tried the temporary workaround seen here:


    (1) Used /force:allowzwobj under  Librarian Command Line (suggested by YongKang Zhu


    (2) Used /FU Platform.winmd /FU Windows.winmd /AI "C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcpackages" /AI "$(WindowsSDK_MetadataPath)"

    under C/C++ Command line (suggested by thefans).

    That did not resolve my issue.

    Note, I started a new Blank Static Library and tried above. Nothing to do with legacy code. Anyone on engineering side should be able to reproduce it.

     I tried only (1) above. That also did not work.

    Could you check if the problem is really resolved. I have VS 11 Beta. Thanks again,


    • Edited by Shafiq2012 Friday, April 27, 2012 10:29 PM
    Friday, April 27, 2012 10:20 PM
  • linking to static lib is obsolete/unsupported in Metro.  It's guaranteed that msvcr110.dll (and the rest of the CRT) will be deployed automatically when your app is downloaded.  No need to include redist.
    Saturday, April 28, 2012 8:54 PM
  • Let me explain why I needed a static lib:

    I build library A as static. It is a third party library.

    Then I build my library B as dynamic library, using library A as Input (which is supported in VS11 for Metro Style App). In both library A and library B I need to access Winrt code (a.k.a. Metro Style App Support set to "Yes").

    So, how will I build library A as static which now needs Winrt code?

    > linking to static lib is obsolete/unsupported in Metro.

    Is there anywhere on DevCenter that states that we cannot build a static library which has "Metro Style App Support" as "Yes"?

    Not now, and not in future?


    • Edited by Shafiq2012 Sunday, April 29, 2012 4:46 AM
    Sunday, April 29, 2012 12:37 AM
  • My mistake, what I meant was that linking to the static CRT is unsupported, but you can make your own static libraries but make sure that your static library actually links to the CRT dynamically.  Maybe that's what you're missing.   What you are doing (creating and consuming your own static libs) should be fine. 
    Sunday, April 29, 2012 2:09 AM