Search code examples
javascriptwindows-store-appswinjswindows-rt

How to instantiate a WinMD file to a Windows Store App Project


Hi have an Windows Store App that need to reference a single Winmd file. I've added it adding as a normal DLL, that's the correct way?

As my understanding I'm trying to "instantiate" it on my default.js as below:

var helloTest = new WinJS.HelloWR.HelloRT();

With that I'm able to access its methods as:

var ret = helloTest.helloRt();

The problem happens when I try to run it, it raises the following exception:

0x800a138f - JavaScript runtime error: Unable to get property 'HelloRT' of undefined or null reference

It means that my HelloWR namespace is undefined, I've been looking around google for some similar sample but I've found anything.

Let me know if anyone need more info about the content of this winmd.


Solution

  • For those whom faces the same problem, I just did as below:

    var helloTest = new HelloWR.HelloRT;
    

    It's not needed to put WinJS as the question at the Top.

    Now I'm able to access its methods:

    var ret = helloTest.helloRt();
    //ret returns 'HelloRT'
    

    If someone explain it better I will check as answer.