Destination IUnknown

Mostly on .NET, Java, Blogosphere, software development and techie stuff by Victor Hadianto

Friday, 27 June 2008

Manually creating Interop dll using tlbimp.exe

Visual Studio .Net automatically creates Interop dll when you reference the COM dll in your project. This is all nice and behaves as expected, but at times you may want to create the Interop dll manually.

Tlbimp.exe is the tool to use. However, strange as it may seems, by default it doesn't do what Visual Studio does. How interesting ...

Visual Studio .Net by default add "Interop." at the beginning of the generated Interop dll and set the namespace as the name of the dll sans the ".dll".

For example, if the dll is called MyCOM.dll. Visual Studio generates: Interop.MyCOM.dll and creates the Interop dll under MyCOM namespace.

To achieve the same effect using tlbimp, you need to use both the /out and /namespace flag. For example:

tlbimp /out:Interop.MyCOM.dll /namespace:MyCOM MyCOM.dll

Sorted.

Labels: ,

Wednesday, 25 June 2008

Resharper Love & Hate

ReSharper is the tool that I can't live without it and I can't live with it. It's easy to say why. First of all I just can't work without the following R# shortcuts:

- Ctrl + N (this probably worth 95% of R# price)
- Ctrl + B
- Ctrl + Shift + B
- Alt + F7
- Ctrl + Shift + F7
- Ctrl + F12

And the code analysis is too darn useful:

- Auto import
- Auto initialise variable through constructor
- Generate getter
- Plus all the refactoring tools (extract method etc. etc. etc.)

But it's really s ..... l .... o .... w. It's worse during debugging session. Every F10 can take up to a second. Evaluating a variable can produce a time-out and it also crashes my debugging session when it's running within NUnit. God knows why.

It's such a shame for such a great tool to be super slow. I often had to turn R# off for debugging and turn it back on during coding. The problem with this is that it often screw up the R# keyboard short cuts and I had to reset it again. This takes about 25 minutes in my PC.

A lot of people complained about R# regarding its memory foot print and more frequently ... performance. This seems to be a common whinge about it. If only R# is a tad faster, we all will be in coding nirvana. I kid you not.

In the mean time I'm investigating CodeRush + Refactor combo as R# replacement.

Labels: