title: Correct way to use multiple .IDL (MIDL) files within a single "Windows Runtime Component C++/WinRT" project
body: <p>Visual Studio 2019. Windows Runtime Component C++/WinRT project.</p>
  
  <p>How do I follow and implement the recommendation: "We recommend that you declare each runtime class in its own Interface Definition Language (IDL) (.idl) file, in order to optimize build performance when you edit an IDL file, and for logical correspondence of an IDL file to its generated source code files. Visual Studio merges all of the resulting .winmd files into a single file with the same name as the root namespace. That final .winmd file will be the one that the consumers of your component will reference."</p>
  
  <p><a href="https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/author-apis" rel="noreferrer">https://docs.microsoft.com/en-us/windows/uwp/cpp-and-winrt-apis/author-apis</a></p>
  
  <p>Within the same project I can add a second (third and so on) .IDL file using Project->Add New Item->Midl File (.idl). This seems to work ok?! I then manually add associated .h and .cpp files for each .IDL file. Build to generate stub files then manually copy and "fill in" these files before a final build which is successful.  In this way I have a single IDL file per runtime class with its associated headers and implementation files including any other files (c++ .h and .cpp files) needed for the implementation. As I need to add functionality to the interface I just edit the IDL file, rebuild and add functionality to the header and implementation C++ files.</p>
  
  <p>Is this what was recommended?!?</p>
  
  <p>When I add the .IDL file and then manually add an associated .h and .cpp they do not appear "under" the .IDL file as the original ones did when I created the new project. Is this just a visual nicety of Solution Explorer OR is this indicating that I have something wrong?!?</p>
  
  <p>I plan to have multiple "C++/WinRT WRC" projects (one for each namespace, each consisting of multiple runtimeclass interfaces with separate .IDL/.h/.cpp files as described above. Then I reference all of the projects (project to project) in my single C#/UWP App.</p>
  
  <p>I am actually trying to implement a user interface to allow me to utilise a large code base of math/engineering C++ classes that implement a very specific &amp; proprietary type of electronic circuit simulation already existing and programmed in C++ and compiled as a console app. The user data in and out is relatively small compared to the processing that takes place to generate the output.</p>