Skip to content
⌘ NSIS Forum Archive

Single installer file(all files and dlls should go in a single installer file)

7 posts

mmsajid#

Single installer file(all files and dlls should go in a single installer file)

Hi,

I required to invoke a dll in my script and I can able to do that by using the below code.But it requires the dll to be in the same level as of the exe, i.e same folder should contain the dlls to be invoked and the .exe.

Which should not be the case, as normally we should have only single exe.

Can any body suggest how can I achieve this.

---------------------------------------------
InitPluginsDir
SetOutPath $PLUGINSDIR
File CLR.dll
File One.dll
File Two.dll

Section
CLR::Call /NOUNLOAD "One.dll" "OneNamespace.OneClass" ".OneMethod"
pop $0
messagebox mb_ok $0
CLR:😁estroy
...
...

SectionEnd
-------------------------------------------
Regards,
Animaether#
There's no need for you to include / extract the plugin file yourself, NSIS will take care of that on the first call.
( You do for the .NET assembly dlls, of course )

After that, instead of "One.dll", try "$PLUGINSDIR\One.dll" as the parameter for CLR?
mmsajid#
Thanks Animaether,

I tried as suggested, but throws below error.
------------------------------
Error calling .NET DLL method

The given path's format is not supported.
------------------------------

But I tried setting the path to $ExeDir and it works fine.
But it copies the dlls to the place where the executable is present.

I can delete the dlls after the installation but I think it is not the good way of doing it.

Iam sure there should be a better way for acheiving this.
Any suggestions will be appreciated.
Animaether#
*eyes the CLR plugin*
quaint

I just tried with the code from:
Are you a developer who uses NSIS to distribute your application? Are you a Winamp plug-in developer who wants to use NSIS to distribute your plug-in? Have suggestions for other people like you? This is the place.

( ignore the VB code - just download the attachment )

Does that sample code + the DLL work for you?
If it does - try substituting the "TestCLRDLL.dll" with your "One.dll", along with the actual .NET methods called. Does that still work?
mmsajid#
Hi Stu,

That was just a typo mistake. But it does not work even if we remove the dot(.).

Thanks,
claesabrandt#
mmsajid, I guess you are having problems calling .NET methods in other .NET dlls from your first .NET dll. The only way to do this is to wrap your installer in another installer. The first installer places the .NET dlls besides the second setup exe. The second setup makes the .NET calls. Now the DLL files can be found from the second installer while you will only be distributing one setup file.