locked
How to create a project that has both Metro style and desktop build configurations

    Question

  • Is it possible in the Visual Studio 2012 Release Candidate to have a single executable project in a solution with multiple configurations, some of which build a Metro style app and some of which build a traditional desktop app? An example of where we want to do this is a project that builds a game executable that we want to build both as a Metro app for the Windows 8 App store and as a traditional full screen DirectX app for older versions of Windows.

    In the Visual Studio 11 Beta we were able to do this. The Metro configurations would enable WinRT extensions with /ZW and had a Metro style entry point / IFrameworkView implementation. The traditional desktop configurations would not enable WinRT extensions and would have a WinMain and a code path to create a full screen DirectX Window. We could switch between configurations and run the app both as a Metro app and as a desktop app from the same Visual Studio Solution.

    After upgrading to the Visual Studio 2012 Release Candidate I have not been able to get this to work. It seems we have to have an AppContainerApplication element in the .vcxproj file in the Globals PropertyGroup set to true for Metro style apps to be deployable and runnable but that having this element present prevents us from building and running the desktop configurations. 

    This project actually has multiple additional configurations targeting a variety of other platforms and in the past we have been able to easily switch between configurations and launch on any target platform. Not being able to do this for Metro apps will be quite frustrating and create extra work for us. Is it possible to make this scenario work with Visual Studio 2012?


    Thursday, June 07, 2012 11:39 PM

All replies

  •  

    Hi,

     

    If there is a such function in Visual Studio, but the C++/CX and many metro API cannot be used in desktop application.

     

    Maybe the project settings change easily, but the codes change hardly.

     

    Best regards,

    Jesse


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

    Friday, June 08, 2012 7:07 AM
  • In a 3D game the majority of the code that uses platform APIs can use the subset of the Win32 APIs that are supported for Metro apps. There's not that many places in the code that need to be different for desktop vs. Metro apps. Our games are already sharing most of their code across multiple platforms that have much greater differences between the platform APIs than desktop vs. Metro apps. 
    Friday, June 08, 2012 7:15 AM
  • I've been digging into this a bit more and it seems that it is possible to make this work. Instead of putting <AppContainerApplication>true</AppContainerApplication> in the "Globals" PropertyGroup in the .vcxproj file for a project, I need to put both <AppContainerApplication>true</AppContainerApplication> and <WindowsAppContainer>true</WindowsAppContainer> elements in the "Configuration" PropertyGroup for the configurations I want to enable Metro Style App Support for.

    This appears to work with the Visual Studio 2012 Release Candidate on Windows 8 Release Preview but projects with this setting fail to load in Visual Studio 2012 Release Candidate on Windows 7 - the project appears with an exclamation mark icon in the Solution Explorer with "(incompatible)" next to the project name and a tooltip says "This project is incompatible with the current edition of Visual Studio". It would be nice if it was possible to load projects with Metro Style App Support on Windows 7 as not all of our developers can move to Windows 8 Release Preview for their development machines.

    I'd like to know if I'm using these elements correctly in the .vcxproj files. Is this how projects with both Metro Style App and traditional Windows Desktop configurations in the same project are supposed to be set up? I'd also like to know if it is possible to make these project files work on Windows 7.

    Wednesday, June 20, 2012 8:35 PM
  •  

    Yes, Based on the SDK document :

    You can use the Windows SDK, along with your chosen development environment, to write Windows Metro style apps (only on Windows 8)

     

    http://msdn.microsoft.com/en-us/windows/desktop/hh852363.aspx#Requirements

     

    Therefore, you need to development the metro application on Windows 8 not Windows 7.

     

    Best regards,

    Jesse


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

    Friday, June 22, 2012 7:56 AM