Tuesday, October 27, 2009

How to find Regasm.exe and use it in a .Bat file

I need to use RegAsm.exe to register several assemblies in a .bat file; however, since RegAsm.exe is not in the system path, it is difficult to just use like Regsvr32 which is always in the system path. I suppose the reason for this is that there can be multiple .NET Frameworks installed and you need to use the correct one.

You can use the WINDIR enviroment variable to get the root of the path. It will probably be something like:

C:\WINDOWS

You then need to add "\Microsft.NET\Framework\" to the path, and finally the path to the specific .NET Framework you are using:

SET fwpath="%windir%\Microsoft.NET\Framework\v2.0.50727"

%fwpath%\regasm.exe app.dll

1 comment:

Anonymous said...

I need to register a .net dll
This is file path - I used to use in win XP but wont work in win7.

C:\username\C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\regasm.exe "C:\Program Files\file path.dll"

Could you please help.

Cheers!

Chris Cunningham