0

I have a dll given by a vendor that 4.0 framework and I am on 3.5. I was told by the vendor that the dll exposes the com interface so I should still be able to use it. I have both a .dll and .tlb file. After doing some research I tried using TlbImp but it gives me an error.

The cmd TlbImp.exe myDll.dll says it's not a valid type library.
The cmd TlbImp.exe myDll.tlb says library was assembled from a CLR assembly and cannot be re imported as a CLR assembly.

Any ideas on what the problem is, or another approach I can use to hopefully access the commands in C# 08? Thanks!

user3646105
  • 2,459
  • 4
  • 14
  • 18
  • Are you trying to use a .NET 4 component in a .NET 3.5 app? I don't understand the COM / TLB involvement here, can you clarify? – JohnD Jul 22 '14 at 21:01
  • Yes the dll is in .NET4 but am trying to use in a .NET 3.5 app. According to the vendor it should still work because it exposes the com interface. Never had to do this before so I am not sure exactly how to do it. Seems that TlbImp would build a dll that I could use in .NET 3.5 but not sure – user3646105 Jul 22 '14 at 21:05
  • Ok I understand. You might want to go read this SO answer: http://stackoverflow.com/questions/2382927/can-i-use-a-net-4-0-library-in-a-net-2-0-application -- they are in a situation similar to you. However, I think the prefered approach would be to upgrade your app to .NET 4.x, if that is at all possible. – JohnD Jul 22 '14 at 21:12

1 Answers1

0

Command should be tlbimp myDll.tlb /keyfile:filename.snk /myDll.dll

keyfile:filename.snk is optional, use correct tlbimp.exe file which is available in the following directory C:\Windows\Microsoft.NET\Framework\VersionX

Refer: http://msdn.microsoft.com/en-us/library/tt0cf3sx(v=vs.110).aspx

DinP
  • 59
  • 7