Sometimes, I want to make a .NET assembly from IDL file since some component vendors still delivers on COM technology.
To do that we need Microsoft Windows SDK that you can download one of these SDK
- Windows SDK for Windows Server 2008 and .NET Framework 3.5(SDK for Windows Server 2008/Windows Vista/Windows Server 2003/Windows XP)
- Windows SDK Update for Windows Vista and .NET Framework 3.0 (SDK for all editions of Windows Vista/Windows XP/Windows Server 2003)
- Windows Server 2003 R2 Platform SDK (SDK for all editions of Windows 2000/Windows XP/Windows Server 2003)
http://www.microsoft.com/downloads/details.aspx?FamilyId=E15438AC-60BE-41BD-AA14-7F1E0F19CA0D
After you download and install the SDK, run the command shell from the SDK. For now, I will use bits.idl as a sample.
In the Command Shell, run "midl bits.idl", without quote, to make the type library from the idl. it will produce some .h, c files and a bits.tlb file.
Convert the tlb file to dll file using tlbimp. for example:
run "tlbimp bits.tlb /out:bits.dll /namespace:Nicko.Bits.COM" without quote. So the assembly bits.dll with namespace Nicko.Bits.COM is ready as a assembly reference in Visual Studio .NET.
Happy coding ![]()
0 comments:
Post a Comment