Attached Custom Action - DLL C# - Error - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

MBonevil
Posts: 45
Joined: Fri Jan 22, 2010 4:48 pm

Attached Custom Action - DLL C# - Error

Hi,

I want to call a function in a DLL in C# before the install files step (like in the InstallInitialize step).

I added a "Attached Custom Action" in the InstallInitialize step.
I selected my DLL and enter the function name.

I obtain an error:
There is a problem with this Windows Installer package.
A DLL required for this install to complete could not be
run. Contact your support personnel or package vendor.

How I can achieve this ?

Thanks.
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hello,

Your custom action needs to be a .NET Installer Class.
Also, use our .NET Custom Action to add it as a custom action to your installer.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
MBonevil
Posts: 45
Joined: Fri Jan 22, 2010 4:48 pm

Re: Attached Custom Action - DLL C# - Error

When I try to add a ".Net Installer Class Action", the software allow me to select a DLL inside my installer... But those files are not available before the step "InstallFiles".

I want to call a function before the "InstallFiles" step.

Can you tell me the steps I need to do ?

I send you what I obtain after adding the custom action in the "InstallInitialize" step (Screen.jpg).
I don't know what to do to be able to call my function (Boolean ReturnTest( ));

Best regards,

Martin
Attachments
Screen.jpg
Screen.jpg (184.26 KiB) Viewed 9167 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hi Martin,

You can add the dll as a temporary file in the Files and Folders page.
This will make the dll available during the whole install process.

The Function Name field holds the name of the function you want your custom action to call.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
MBonevil
Posts: 45
Joined: Fri Jan 22, 2010 4:48 pm

Re: Attached Custom Action - DLL C# - Error

Hi,

I selected my DLL in the Temporary folder (Screen2.jpg).
I've written the function name in the corresponding field (Screen1.jpg).

I got an error (Error.jpg) when executing the installer.

P.S.: My custom function return a boolean... How I can get the return value ?

Best regards,

Martin
Attachments
Error.jpg
Error.jpg (23.98 KiB) Viewed 9159 times
Screen2.jpg
Screen2.jpg (66.87 KiB) Viewed 9159 times
Screen1.jpg
Screen1.jpg (56.62 KiB) Viewed 9159 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hello,

I am afraid returning values from C# custom actions is not supported by Windows Installer.
Also, I am afraid my suggestion to add the DLL as a temporary file was incorrect. The DLL must be installed for it to work. Add it as an ordinary installed file. Install it in the temp folder. In Advanced Installer add it under Windows Volume->Temporary from the Files and Folders page.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
MBonevil
Posts: 45
Joined: Fri Jan 22, 2010 4:48 pm

Re: Attached Custom Action - DLL C# - Error

ok...

But my first question was:

"I want to call a function in a DLL in C# before the install files step (like in the InstallInitialize step)."

How I can do this ?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hello,

Placing a custom action before the InstallFiles standard action can be done like this:
- on the custom actions page, right click inside the tree and select Show Standard Action->Before File Installation->InstallInitialize.
- the InstallInitialize standard action will now be shown in the tree.
- simply drag and drop your custom action on the InstallInitialize step and it will be placed right after it, thus before the InstallFiles standard action.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
MBonevil
Posts: 45
Joined: Fri Jan 22, 2010 4:48 pm

Re: Attached Custom Action - DLL C# - Error

Hi,

Yes, these steps work well.

But how I can call an external DLL in this step ?

Best regards,

Martin
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hi,

I am afraid Windows Installer does not support external .NET DLLs. The DLL must be installed.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
pratap.shukla
Posts: 1
Joined: Thu Feb 04, 2010 1:56 pm

Re: Attached Custom Action - DLL C# - Error

Hi,

I need to call a dll function from my java program. The function is :

public native boolean setHotKey(int virtualKey, boolean alt, boolean control, boolean shift, boolean win);

I am able to call it directly from my jar, however, it doesn't work when I run my jar by the exe created by Advance installer.

Thanks
Pratap
Attachments
GlobalKeyboardHook.cpp
(3.75 KiB) Downloaded 369 times
com_biletnikov_hotkeys_GlobalKeyboardHook.h
(1.04 KiB) Downloaded 362 times
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Attached Custom Action - DLL C# - Error

Hello,

On the Java Products page, go to Virtual Machine tab and press the "Folder..." button under "Java Library Path" section. Add the folder containing your DLL.
Rebuild your project. It should now work properly.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”