locked
Reference components for debug and release configurations

    Question

  • I am developing a Metro application in which GUI project is using HTML/Javascript. I have 3 c++ components. Now, how should I add their reference to the GUI project so that selecting Debug/Release configuration picks up the correct configuration of the c++ component?

    While adding the reference to JS project, it just asks for a path of .winmd file, therefore I am not sure how to set it correctly for debug and release configurations.

    • Moved by Jesse Jiang Wednesday, October 24, 2012 6:00 AM (From:Visual C++ General)
    Tuesday, October 23, 2012 1:03 PM

Answers

  • Hi,

    We would suggest you to create C++ components from the template.

    The Windows Runtime Component template will help you do the correct settings.

    Best regards,
    Jesse


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

    • Marked as answer by Jesse Jiang Thursday, November 8, 2012 8:51 AM
    Wednesday, October 24, 2012 6:03 AM
  • Hey,

    we had same problem, meaning we had winmd/dll files only, but no Visual Studio projects, so the only way to reference them - was by file, referencing WinRT components by project was not an option. And like you we could only reference one file for all configurations and platforms.

    There's no way to set this correctly from Visual Studio UI, but you can fix this by editing *.vcxproj with text editor.

    Locate Reference tag, and modify the lines accordingly, for ex.,

        <Reference Include="MyComponent">
          <HintPath>$(TargetedSDKArchitecture)\lib\$(Configuration)\MyComponent.winmd</HintPath>
          <IsWinMDFile>true</IsWinMDFile>
        </Reference>

    As you see depending on the configuration and platform, appropriate winmd file will be picked, so let's say if you want to build X86 Debug.

    X86\lib\Debug\MyComponent.winmd will be picked.

    If X86/Release - X86\lib\Release\MyComponent.winmd will be picked.

    Cheers

    • Marked as answer by Jesse Jiang Thursday, November 8, 2012 8:51 AM
    Wednesday, October 24, 2012 7:38 PM

All replies

  • I understand that you're dealing with C++ components, but as the context is a Windows Store (new name for Metro?) app, you may want to ask here as well:

    http://social.msdn.microsoft.com/forums/en-us/category/windowsapps
    Tuesday, October 23, 2012 2:10 PM
  • Hi,

    We would suggest you to create C++ components from the template.

    The Windows Runtime Component template will help you do the correct settings.

    Best regards,
    Jesse


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

    • Marked as answer by Jesse Jiang Thursday, November 8, 2012 8:51 AM
    Wednesday, October 24, 2012 6:03 AM
  • Hey,

    we had same problem, meaning we had winmd/dll files only, but no Visual Studio projects, so the only way to reference them - was by file, referencing WinRT components by project was not an option. And like you we could only reference one file for all configurations and platforms.

    There's no way to set this correctly from Visual Studio UI, but you can fix this by editing *.vcxproj with text editor.

    Locate Reference tag, and modify the lines accordingly, for ex.,

        <Reference Include="MyComponent">
          <HintPath>$(TargetedSDKArchitecture)\lib\$(Configuration)\MyComponent.winmd</HintPath>
          <IsWinMDFile>true</IsWinMDFile>
        </Reference>

    As you see depending on the configuration and platform, appropriate winmd file will be picked, so let's say if you want to build X86 Debug.

    X86\lib\Debug\MyComponent.winmd will be picked.

    If X86/Release - X86\lib\Release\MyComponent.winmd will be picked.

    Cheers

    • Marked as answer by Jesse Jiang Thursday, November 8, 2012 8:51 AM
    Wednesday, October 24, 2012 7:38 PM
  • How the templates are going to help here? Can you explain a bit?

    Is there a template which shows how to use the component as reference in another project?

    Thursday, October 25, 2012 6:40 AM
  • Hi,

    You can use Windows Runtime Component template, so that we can include the reference like .NET

    Best regards,
    Jesse


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

    Monday, October 29, 2012 5:54 AM