Results 1 to 10 of 10

Thread: [RESOLVED] Custom Action Problem

  1. #1

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Resolved [RESOLVED] Custom Action Problem

    Hi.
    I have a solution that has a application project and a setup project.
    The problem i have is that i want after the installation to do some exta stuff.
    I create a new ClassLibrary project and i add an classinstaller. Now the problem i have is on how to make this installer to run after the installation of my original program. When i tried to add the Dll of the installerclass to the commit custom action, i get the error "Could not find file d:\xxxxx\ClassLibrary1.Installstate.
    Am i doing something wrong? I also did "setup-add-project output" and selected all the classlibrary1 output.Then added it on the commit custom action but the problem is there.
    I have to say tha i used my code inside the installer of the classlibrary1, after "InitializeComponent()"
    .

  2. #2
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Custom Action Problem

    check out this how to article on MSDN

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom Action Problem

    I found that the InstallState file needs to be created on one of the Install events so that it can be found when you handle one of the Commit events. Add an empty event handler for BeforeInstall or AfterInstall and it should create the InstallState file that will then be found in the Committing or Committed event handlers. You should also add an empty event handler for AfterUninstall so that the InstallState file will be deleted if your app is unistalled.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  4. #4

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom Action Problem

    I have read the exact article before but unfortunately i does not explain how to handle 2 projects.
    How exactly do i add an empty output on the Install,before etc actions!?
    Also i could make it simpler for you:
    I have an exe file that i want to run at the custom_action-commit phase.
    Can i do that and how?

  5. #5
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom Action Problem

    You've already added an event handler for one event. Adding a handler for other events is done exactly the same way. You then just leave the generated methods empty.

    Having said that, if you want to run an executable then you don't need any installer classes at all. When you tell the IDE to create a custom action you simply select the file you want executed. If you don't set its InstallerClass property to True then it will simply be run as a normal executable without looking for an installer class and its corresponding event handlers. That means that you must add this executable to your setup project so that it can be selected when you want to add a custom action.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  6. #6

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom Action Problem

    I've tried adding handlers for the other actions but it does not work.
    It only works if you put the SAME handler on all the actions.
    The executable idea works and i thank you for that.
    One last thing.
    If i put an executable in the commit action and this executable requires a dll to function then just adding the dll to the setup project will work?
    Thanks.

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom Action Problem

    If i put an executable in the commit action and this executable requires a dll to function then just adding the dll to the setup project will work?
    Assuming that the library is in the same folder as the executable then yes.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom Action Problem

    Mmm.
    But i think that when you add the exe to the setup it does not look back on witch folder you added it from. Ok because i've trouble you enought, let's say i bring the dll to the same folder as the exe and then add them both on the setup. Will that be ok?

  9. #9
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: Custom Action Problem

    It doesn't matter where they are on your machine, only where they are on the machine on which they're being executed. I've never tried this with an executable that wasn't installed in the proam folder, so I don't know all the variations. If you have your setup install both the EXE and the DLL to your program folder then you'll have no issues. Other than that I can't say.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  10. #10

    Thread Starter
    King of sapila
    Join Date
    Oct 2006
    Location
    Greece
    Posts
    6,763

    Re: Custom Action Problem

    Ok.
    Thank you very much.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width