how to run some code in the begining of setup - 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!

Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

how to run some code in the begining of setup

Hi,
I want to run C# code during the welcome dialog, Can I do that ?
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run some code in the begining of setup

Hi,

You can create a fully fledged .NET custom action and schedule it after WelcomeDlg standard action. You can also add it as an UI Custom Action and run it with a DoAction event published from a control on the WelcomeDlg.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

Re: how to run some code in the begining of setup

Hi,
first of all thanks for your help, I have made a custom action refered to a function I have created

Code: Select all

 [CustomAction]
        public static void create_Auth_file()
        {
            MessageBox.Show("Please attach a debugger to rundll32.exe.", "Attach");
            string machine_name = Environment.MachineName.ToString();
            string win_drive = Environment.GetEnvironmentVariable("windir", EnvironmentVariableTarget.Machine).Substring(0, 1);
            FileStream fs = new FileStream(win_drive + ":\\Auth_" + machine_name +".txt", FileMode.Create, FileAccess.Write);
            StreamWriter m_streamWriter = new StreamWriter(fs);
            m_streamWriter.Flush();
            fs.Close();
        }
I made it under the UI custom actions the go to the dilaogs window, in the button next in welcome dialog, I created a new published event(Do action) and the argument is my custom action and let the condition =1
after building the project and running it, an error occured ""There is a problem with windows installer package, a dll required for this install to complete could not be run. Contact your support or pachage vendor""
Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

Re: how to run some code in the begining of setup

I have changed the signature of the function to be

Code: Select all

 public static ActionResult createAuthFile(Session session)
        {
 return ActionResult.Success;
        }
and also the same error appears.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run some code in the begining of setup

Hi,

Can you please send us the .AIP (project) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

Re: how to run some code in the begining of setup

Hi,
what is the verbose log and where can I find it.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: how to run some code in the begining of setup

Our support team usually include inline links to the user guide or other relevant Internet articles. To answer your question, simply click on the blue text from my last post.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

Re: how to run some code in the begining of setup

thanks, I have sent the project and the log to the support mail.
Hanan Ali
Posts: 20
Joined: Tue Nov 01, 2011 10:11 am

Re: how to run some code in the begining of setup

I have sent the project to the support mail and noone reply to me :(
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: how to run some code in the begining of setup

Hi Hanan,

The first e-mail you've sent was on the wrong address, so we received the second one from you, on November 20. We usually respond to our users in maximum 24 hours because in some cases investigations need to be made and some time is required. I've just managed to answered your e-mail, you can check your Inbox for more details.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”