0

I am developing a UWP App in C# and I would like to use a C++ function from a C++ "Windows Runtime Component" project in the same solution, however, when I add a project reference of the C++ project to the main app, I cant use it's namespace in C# files. When I write

using WindowsRuntimeComponent1;

the compiler says that the namespace can't be found. What am I doing wrong?

Here is the C++ header file "Class1.h" (Visual Studio Created Class1 by default, I didn't change anything)

#pragma once
namespace WindowsRuntimeComponent1
{
   public ref class Class1 sealed
   {
   public:
      Class1();
   };
 }
mjw
  • 400
  • 4
  • 20
  • Possible duplicate of [How do I add a reference to an unmanaged C++ project called by a C# project?](http://stackoverflow.com/questions/5107694/how-do-i-add-a-reference-to-an-unmanaged-c-project-called-by-a-c-sharp-project) – mybirthname Jan 20 '16 at 16:19
  • In my new created fresh project it has been solved by adding "Microsoft Visual C++ 2013 Runtime Package for Windows Universal" but in my own project everything is included, but it still doesn't work. Maybe a wrong configuration in my Runtime Component project. – mjw Jan 20 '16 at 16:30
  • The only requirements that I can think of are that it's referenced by the C# project and that the WR component was actually successfully built at least once for VS to recognize the namespace exists. – Ma3x Jan 20 '16 at 16:31
  • Compile the C++ project so the .winmd file gets created and IntelliSense can work. – Hans Passant Jan 20 '16 at 16:36
  • Thanks for all your answers, I did all of that, it seems like it really was a strange configuration. I created a new Runtime Component project and everything worked out, I'm doing copy and paste with my code right now, I let you now if that even works. – mjw Jan 20 '16 at 16:42
  • Ok, it works now, it has been solved by creating a new project im my solution, so it was just something strange. – mjw Jan 21 '16 at 13:11

0 Answers0