Archive: How do I register.net library thru NSIS Script


How do I register.net library thru NSIS Script
Hi,

How do I register.net library thru NSIS Script.Pls provide me sample script.


Thanks in Advance;)


The following Wiki page has some information about this.

http://nsis.sourceforge.net/Register...DLL_in_the_GAC


Hi,

I tried to put my dll in GAC by using the below script but I was not able to register.

;R0 "$INSTDIR\mydll.dll"'
nsExec::Exec '"$WINDIR\Microsoft.NET\Framework\v1.1.432\GacUtil.exe" /i "$R0" /f'


for the GACUtil do I need to give the above path or "..\Program Files\Microsoft Visual Studio 8\VC\gacutil\"

Iam not sure what's wrong in it.Even I tried like this

ExecWait '"$WINDIR\Microsoft.NET\Framework\v1.1.432\GacUtil.exe" /i "$INSTDIR\mydll.dll"' still I am not able to register.

Thanks


If you point to the Visual Studio directory, only users with Visual Studio will be able to install your application. You don't want that. Probably a better overall solution would be including gacutil.exe with your installer.


After Calling this script
R0 "$INSTDIR\mydll.dll"'
nsExec::Exec '"$WINDIR\Microsoft.NET\Framework\v1.1.432\GacUtil.exe" /i "$R0" /f'
;(or)
ExecWait '"$WINDIR\Microsoft.NET\Framework\v1.1.432\GacUtil.exe" /i "$INSTDIR\mydll.dll"' still I am not able to register.

I was not able to find "mydll.dll" in GAC.

What's wrong in it?.


Does that work from the command line? Are you sure gacutil.exe really exists? Why not package gacutil.exe with your installer, as I suggested?


Yes it's working in command line and gacutil is exists in "\Microsoft.NET\Framework\v1.1.432\GacUtil.exe"


Try executing it with nsExec. Maybe it prints some kind of an error.


Hi,

I have one more gacutil under the following folder.

nsExec::Exec '"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe"

If I use the above path in the script It's registering .

If I use this path it's not registering. "\Microsoft.NET\Framework\v1.1.432\GacUtil.exe"


Thanks,
Gnanaprakash


nsExec::Exec '"C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe"
this path points to your local system, probably is not valid for every target.
If I use this path it's not registering. "\Microsoft.NET\Framework\v1.1.432\GacUtil.exe"
Also, this one is partially hard coded therefore useless for every machine.
Why not just package gacutil with your installer as kichik suggested twice?
If you want anyway to use the gacutil that resides on the target, you need to grab in a variable the framework path from registry, and use it like this,
ReadRegStr $0 HKLM "SOFTWARE\Microsoft\.NETFramework" "InstallRoot"
nsExec::Exec "$0\v1.1.4322\gacutil.exe"

Yes,I am packaging gacutil with installer as kichik suggested .

Thanks for helping me :)


You are not allowed to distribute GACUtil.
Also, different versions of gacutil (namely, 1.1 and 2.0) install the assemblies to different GACs (1.1 and 2.0 accordingly). So the correct way is to use Fusion DLLs on the target systems.


I read the following note from the link posted by kichik:
- The above will not work in most cases on Vista, since you need permissions to do it. So we need some way to do the above from within NSIS. I have no idea how.

Retrieved from "http://nsis.sourceforge.net/Register_a_managed_.NET_DLL_in_the_GAC"


Is there any alternative for Vista? If my permission level is set to 'admin' would I still have problem on Vista? thanks!