Archive: .NET Assemblys RegAsm


.NET Assemblys RegAsm
Hi!

I'm using the NSIS for the first time.


I want to make an Installer which installs severals .NET Assemblys. I've found here how to make it that i can use the gacutil.

But how can I implement that the Nsis register my class by RegASM?

Thank you all for your help

Haggy


Is RegASM an executable too? If so, just execute it using ExecWait, Exec or the nsExec plug-in.


Hi
Yes it is, but I don't know the path of it.

Because it is in the .NET Directory and there in the Directory of the Current version e.g. 1.1.387 and i don' know how to get the current installed version auf .NET Framework, the user has :-/

I don't know too if the regasm and the gacutil were only in the SDK or in the standard framework included.

thank you

Haggy


Well, if it's not big, I think you can save yourself the hassle and just include it in the installer. If it is big, you might be able to get the directory of the latest .NET framework using a varient of the following function:

http://nsis.sourceforge.net/archive/....php?pageid=24

Please post your result on the Archive, if you can get that function to give you the directory of the latest version.

BTW, I think gacutil and regasm come only with the SDK, but MSDN will probably know better.


Simple Reg Script solution
Since COM registration is a registry only based operation you can use the regasm tool on your local machine to generate the registry script that can be used to install your component. You can then use the standard registry manipulation tools in NSIS to update the registry. Simply add the /regfile:output parameter to the command line of the regasm tool to create the script.


And to convert from .reg to .nsi you can use this tool:

http://nsis.sourceforge.net/archive/...php?pageid=296


Can I just make the point that if you are using regasm to register your assembly, you should also unregister it in your uninstall section. Therefore if you are using a .reg file, you need to create one for registering and one for unregistering your assembly and package both of them.

Because of this problem I have decided to register my assemblies on the machine using regasm (this gives a double check that the .NET framework is install btw because if regasm is no-where to be found - it needs to be installed)

I have a problem however with the following lines:

ClearErrors

;find the location of RegAsm
ReadRegStr $R1 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Microsoft .NET Framework 2.0" "InstallLocation"

;execute regasm passing the path to my assembly
Exec '"$R1RegAsm" "${sInst}${sApp}.exe" /silent /tlb:"$SYSDIR\${sApp}.tlb" /codebase'
IfErrors 0 +2
MessageBox MB_OK "Error Registering ${sInst}${sApp}"

The assembly registers ok but even though I am specifying the /silent option, I still get a empty dos style box appearing at this point.
This will be a particular problem for me because I have around fifty of the these assemblies to register!

Has anyone come across this problem?


You can use the nsExec plug-in which is bundled with NSIS, or the ExecDos plug-in.