Reputation: 1880
I have a Windows Phone 8 solution with 2 projects:
In this solution, the "Hello" library references the WP Runtime Component, so calls like...
HelloNativeRT.SampleNamespace test = new HelloNativeRT.SampleNamespace();
...work fine in this library project.
However, I want to use these two libraries in a Windows Phone 8 app, but without adding references to the projects, since I need to ship the compiled libraries to clients.
HelloNativeRT.SampleNamespace test = new HelloNative...
it crashes and says "TypeLoadException", like it cannot load the native module.I suppose I need to include the HelloNativeRT.dll file in a way or another, since I guess it contains the native (compiled) code, as the winmd file may only embed the C++/CX code.
How should I setup my project to include this DLL?
I tried to put it at the root of the WP8 project, to reference it, to embed it... with no luck.
Upvotes: 3
Views: 3078
Reputation: 1880
The reason was quite simple in my case: the .winmd file and the .dll file generated from the WinRT Component must have THE SAME NAME (e.g: testRT.dll and testRT.winmd).
Then:
Upvotes: 4
Reputation: 7634
You need to:
WPAppManifest:
<ActivatableClasses>
<InProcessServer>
<Path>external_component.dll</Path>
<ActivatableClass ActivatableClassId="external_component.MyComponent" ThreadingModel="both" />
</InProcessServer>
</ActivatableClasses>
This last point is the one that is auto-magically done by Visual Studio when you reference a WinPRT project from a WP8 project ;-) I suppose not a lot of people are referencing native libs manually, since the documentation on that point is very sparse. The only link where I saw the solution mentionned was here...
Upvotes: 3