How to use c# reference project in c++ (xaml+directX) project? RRS feed

  • Question

  • My project is using c++ under the structure of xaml and directx. 

    Can this project use c# project as a reference project?

    I managed to add the c# project into my c++ project, but encountered errors when trying using "#using ...refereceproject.namespace..."

    Any comment is helpful and thank you in advance.



    Tuesday, June 25, 2013 2:12 AM


  • Yes, this should be possible - the easiest way is generally:

    1. Package your C# project as a Windows runtime component (in Visual Studio: go to File -> New Project, and select Windows Runtime Component under the C# section)
    2. Add a reference to the C# project from your C++ project (right click C++ project -> References -> Add New Reference and select your C# project)
    3. You should now be able to reference and use the C# project

    A "using" declaration would then look something like:

    using namespace WindowsRuntimeComponent1;

    • Marked as answer by shenzyapp Wednesday, July 24, 2013 6:59 AM
    Monday, July 22, 2013 5:52 PM