microsoft / cppwinrt

C++/WinRT
MIT License
1.64k stars 236 forks source link

Bug: C++ WinRt imports all idl files in the folder even when not declared in the vcxproj #1368

Closed Manohar-Gunturu closed 10 months ago

Manohar-Gunturu commented 10 months ago

Version

2.0.221121.5

Summary

How to exclude an idl file in a C++ winRt project. Is it possible to exclude an idl file based on Configuration condition? Seems C++ WinRt project grabs all idl files in the project folder and build them even if they are not declared ( using ) in vcxproj.

Reproducible example

  1. Create a C++ WinRt project
  2. In the project folder manually create an idl file called sample.idl using file explorer.
    namespace Calculator
    {
       [default_interface]
       runtimeclass Exponential: Math.Function
       {
       }
    }

    Note: this is not imported/added in VS and no Midl import declaration for this idl file in project vcxproj file.

  3. Build the project
  4. Build complains that error MIDL2011: [msg]unresolved type declaration [context]: Math.Function

Expected behavior

Project not supposed to build sample.idl as it is not imported.

Actual behavior

Builds every idl available in the folder even if they are not defined in vcxproj file

Additional comments

No response