Answered by:
How to add a reference to a c++ runtime component?

Question
-
Hi,
Image the scenario where you are given a C++ runtime component consisting of winmd and dll file.
I've been trying to add a reference to that component and have managed to get it working when the app is a C++ XAML app, see here:
https://social.msdn.microsoft.com/Forums/sqlserver/en-US/898611dc-d8c8-4623-9b40-7819f8d3e36d/how-to-manually-add-reference-to-runtime-component?forum=winappswithnativecode
This is working by manually editing the vcxproj file and adding an <Implementation> tag with the name of the dll.
I would also like to use the component from Javascript but manually editing the jsproj file hasn't worked:
<Reference Include="TestRC">
<HintPath>..\..\TestRC.winmd</HintPath>
<IsWinMDFile>true</IsWinMDFile>
<Implementation>TestRC.dll</Implementation>
</Reference>
Is this possible from a Javascript (blank) app?
Thanks for the help.
Monday, December 1, 2014 5:13 PM
Answers
-
Actually the implementation tag was working, but when the project reference is removed I lost the automatic reference to the "Visual C++ Runtime Package for Windows". Added this back and it all works fine.
- Proposed as answer by Oliver Ulm Tuesday, December 2, 2014 11:12 AM
- Marked as answer by Jamles HezModerator Wednesday, December 3, 2014 9:26 AM
Tuesday, December 2, 2014 10:52 AM
All replies
-
Forgot to add, if I add the c++ runtime component project to the solution and set it as a "project reference" then it works fine. However going forward we will only have access to the binaries.Monday, December 1, 2014 5:16 PM
-
Hi Wantabeguitarboy,
Will you follow the guideline: Walkthrough: Creating a basic Windows Runtime component in C++ and calling it from JavaScript or C#
You can simply add the reference to your C++ runtime component by following steps instead of modify the jsproj file.
-
In Solution Explorer, open the shortcut menu for the Solution node and choose Add, New Project.
-
Expand JavaScript (it might be nested under Other Languages) and choose Blank App.
-
Accept the default name—App1—by choosing the OK button.
-
Open the shortcut menu for the App1 project node and choose Set as Startup Project.
-
Add a project reference to WinRT_CPP:
-
Open the shortcut menu for the References node and choose Add Reference.
-
In the left pane of the References Manager dialog box, select Solution and then select Projects.
-
In the center pane, select WinRT_CPP and then choose the OK button.
-
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Tuesday, December 2, 2014 1:27 AMModerator -
-
Hi Jamles,
Thanks for the reply. However I am trying to add a reference to a prebuilt component, see my previous posting:
"Forgot to add, if I add the c++ runtime component project to the solution and set it as a "project reference" then it works fine. However going forward we will only have access to the binaries."
Any ideas how I can achieve this?
Tuesday, December 2, 2014 9:06 AM -
Actually the implementation tag was working, but when the project reference is removed I lost the automatic reference to the "Visual C++ Runtime Package for Windows". Added this back and it all works fine.
- Proposed as answer by Oliver Ulm Tuesday, December 2, 2014 11:12 AM
- Marked as answer by Jamles HezModerator Wednesday, December 3, 2014 9:26 AM
Tuesday, December 2, 2014 10:52 AM