How programattically use RegAsm.exe in Visual Basic 2013

I would like to write a Console program to automatically register COM dlls. The batch file I am using contains the following line of code.
"C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Regasm.exe" "C:\OtherDLL\ShowNotes\ShowNotesVS.dll" /tlb:"C:\OtherDLL\ShowNotes\ShowNotesVS.tlb" /codebase

Open in new window

I found this code but it does not work. The tlb is not created and I do not know how to tell if the registration completed automatically. The variable returned is true but I do not know how to verify if it registered or not.

Imports System.Reflection
Imports System.Runtime.InteropServices

Dim asm As Assembly = Assembly.LoadFile("c:\OtherDll\ShowNotes\ShowNotesVS.dll")
        Dim regAsm As New RegistrationServices()
        Dim bResult As Boolean = regAsm.RegisterAssembly(asm, AssemblyRegistrationFlags.SetCodeBase)

Open in new window

What should the registration code look like?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jacques Bourgeois (James Burger)PresidentCommented:
Not tested, but it should look something like the following:

Dim process As New System.Diagnostics.Process()
Process.Start("C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Regasm.exe", """C:\OtherDLL\ShowNotes\ShowNotesVS.dll"" /tlb:""C:\OtherDLL\ShowNotes\ShowNotesVS.tlb"" /codebase")

Open in new window

The double double quotes ("") are used to insert the necessary quotes inside of the string for the arguments.

You might want to give a look at the Process class in the documentation if you end up having problems. Because regasm is an admin tool, you might have to provide more information through the different properties of the class to make it work.

On question I would ask however. RegAsm is used to register .NET dlls, and I have never seen .tlb files used with .NET dlls. Can they be used? Usually, .tlb files are used with COM dlls. .NET uses a manifest built into the dll instead of external files.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
mpdillonAuthor Commented:
Thank you. That did start the process.

I will be posting a related question almost immediately.

Thanks again,
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.