amalborn
Posts: 6
Joined: Fri Dec 05, 2008 8:03 pm

VB .Net

Hi
Im my VB. NET project I have a function that sets up some variables for the app depending on the options the user choose during installation.
Can I call a VB. NET function from the intsaller?

Thanks
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: VB .Net

Hi,

Windows Installer can use only this type of custom actions:
- a C++ DLL
- a VBScript file
- a JScript file
- an EXE

Therefore, you cannot call a function from VB .NET. However, you can create an EXE for the function you want to call and add the EXE as a custom action.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
amalborn
Posts: 6
Joined: Fri Dec 05, 2008 8:03 pm

Re: VB .Net

cosmin wrote:Hi,

...
Therefore, you cannot call a function from VB .NET. However, you can create an EXE for the function you want to call and add the EXE as a custom action.

Regards,
Cosmin
Do you have an example for this? can I pass arguments for the EXE ?
Thanks
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: VB .Net

Hi,

Please note that you can use a New Attached Custom Action or an Exe with working Dir custom action to launch the EXE. We don't have sample projects for them because they are easy to use.

For an attached custom action you can set the parameters you want to pass in the "Command Line" field of the "Custom Action Properties" page. For an "Exe with working Dir" custom action you can add the parameters after the path to the EXE in the "Full Path" field.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
amalborn
Posts: 6
Joined: Fri Dec 05, 2008 8:03 pm

Re: VB .Net

Hi
How can I make sure that the exe file runs after the sql scripts? (the sql script creates the database and tables, the exe should put some data on several tables).
Thanks
dms
Posts: 164
Joined: Tue Aug 28, 2007 7:11 am
Location: UK

Re: VB .Net

If your sql scripts are creating a database and the .exe is then populating all or some of that databases tables with data then another approach for you might be to look at the following product from Red Gate:

http://www.red-gate.com/products/SQL_Packager/index.htm

This makes just about anything that you do with sql a whole lot easier and it will produce either an exe file or a sql script that you can use to both deploy and populate your database. The finished scripts or files work well with AI, and there is the added advantage (or not as the case may be!!) that you can always install the created files to a seperate directory to be called up directly by your end user should the need arise.

Dom
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: VB .Net

Hi,

The SQL Scripts run during the "InstallExecuteSequence" -> "InstallODBC" standard action. Therefore, you can schedule your EXE after it. Please note that your custom action should be executed as deferred or commit. You could also schedule the custom action under "InstallExecuteSequence" -> "InstallFinalize" as Immediate.

In order to see a standard action you can use the "Show Standard Action" button on the toolbar of the "Custom Actions" page.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”