Introduction
It is a very common problem faced by developers working on VB to VB.NET migration project. If VB6 project is using some DLLs which are further referencing .TLBs (type libraries), then this VB6 project cannot directly be migrated to VB.NET using upgrade wizard. It will not create InterOps for those DLLs which are using .TLBs.
Background
While working on a migration project, I faced an issue that I was not able to add a DLL reference to my converted (from VB6 to VB.NET) .NET solution. Ideally conversion wizard automatically makes the InterOps for the DLLs being referred in VB6 project. In my case, it was showing that DLL in my solution but a yellow exclamation mark on it.
Steps
In order to resolve this issue, one can follow the steps given below:
- Check for the references in your VB6 project and note down the .tlb references and their locations.
- Go to the location "C:\WINDOWS\system32\URTTEMP" at command prompt and execute "regtlib.exe" along with the .tlb name with full path.
e.g. C:\WINDOWS\system32\URTTEMP>regtlib C:\TestFolder\test.tlb
In the above example, my .tlb file name is test.tlb and placed at location "C:\TestFolder". This command will register the .tlb file
- Recompile your VB6 DLL.
- Now add the reference of this newly compiled DLL into your VB.NET solution.
It will now create the InterOp for your VB6 DLL automatically.