Click here to Skip to main content
15,881,172 members
Articles / Desktop Programming / ATL
Tip/Trick

Generate TLB for Arbitary IDL in Build

Rate me:
Please Sign up or sign in to vote.
0.00/5 (No votes)
26 Aug 2013CPOL 11K   1  
To generate a TLB file for an IDL file in build

Sometimes, you have multiple IDL files in your ATL project. By default, you will only see one TLB file generated after build. But how to generate a separate TLB file for a specific IDL file?

You could follow the steps below to achieve this goal:

  1. Open your ATL project (assuming it is A.vcxproj) in Visual Studio.
  2. Right-click the project and click "Unload Project".
  3. Right-click the project again and click "Edit A.vcxproj".
  4. Find the IDL file name (assuming it is M.idl) in the editor. It should be within a <Midl> tag.
  5. Add <TypeLibraryName> tags inside <Midl> and condition them with your build configurations and platforms. An example is as below:
XML
<Midl Include="M.idl"> 
  <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">M.tlb</TypeLibraryName>
  <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">M.tlb</TypeLibraryName>
  <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">M.tlb</TypeLibraryName>
  <TypeLibraryName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">M.tlb</TypeLibraryName>
</Midl> 

Then M.tlb for your M.idl will be generated to your source code folder in build.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
China China
Over 10-years experience in using Microsoft technologies.
At present, working as the architect of a clustered real-time data delivery and visualization system, responsible for the design of component architecture, product packaging and deployment, also targeting private cloud solutions for future.

Comments and Discussions

 
-- There are no messages in this forum --