blog.easyciel.net author="Patrick Rabian" about="c#, sharepoint, biztalk, team system resources" more="news, samples, tips for .NET world's developers !"

Create a interop DLL from a COM DLL

Tuesday, 29 May 2007 10:05 by prabian

As Visual Studio 2005 can do while referencing a registered COM library, you can use the following scripts to automate the creation of an interop :

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\tlbimp.exe"
MyLibrary.dll
/out:Interop.MyLibrary.dll
/namespace:NewRootNameSpace
/keyfile:MyLibrary.snk
/reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.dll
/reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.data.dll
/reference:C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.xml.dll
/verbose
/asmversion:1.0.0.0

(If necessary, add reference options)

For a recall, the strong named key is created with :

"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\sn.exe" -k MyLibrary.snk

Don’t forget to register the library with regsvr32.exe before executing the first script

WARNING ! For COM library created from VB and using instructions like ReDim, it is useful to add the option :  /sysarray to have System.Array declared (for intance : instead of string[] for String() VB parameters).

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Related posts

Add comment


(Will show your Gravatar icon)  

  Country flag

[b][/b] - [i][/i] - [u][/u]- [quote][/quote]



Live preview

November 20. 2008 23:49