How to limit the platform for included references? (without editing the .csproj with a text editor) RRS feed

  • Question

  • I'm including a third party library in my solution. Every third party library has its own project in the "template" that I'm writing for my company. The problem I'm having is that the RT and standard Win8 libraries use the same namespaces, classes, etc and conflict with each other. I can't figure out how to do this through the UI of Visual Studio 2012 Express.

    I've worked around this by editing the .csproj file with a text editor and adding the condition to the Reference, resulting in the following:

        <Reference Include="ThirdPartyLib" Condition="'$(Platform)' != 'ARM'">
        <Reference Include="ThirdPartyWP8Lib" Condition="'$(Platform)' == 'ARM'">

    This works, but it's a bit hackish -- not the greatest method to pass on to the folks who will bring our future titles to Windows Store. (though it's likely they won't have to do this themselves, unless future third party modules have the same problem and need to be developed outside of my template)

    Anyway, is there a cleaner, more appropriate way to do this?

    And if not, I hope this post helped others stuck on the same problem. :)

    (note: The same question [and my "hack" solution] applies to individual .cs files. A different third party module requires two separate .cs files and two separate libraries.)
    • Edited by combinatorial Thursday, February 21, 2013 7:44 PM added note on bottom
    Wednesday, February 20, 2013 8:11 PM


  • Hi combinatorial,

    I didn't see an elegant solution for this. I am afraid you need to manually edit the csproj file to accomplish this. Otherwise you will need to use a seperate project for each configuration.

    Best regards,

    Min Zhu
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by combinatorial Tuesday, February 26, 2013 7:16 PM
    Monday, February 25, 2013 6:52 AM