none
My custom action is not executed

    Question

  • I want to install an Excel xla addin after the end of the installation of my Windows Forms application.

    I tried to create a custom action, but it doesn't run.

    I followed the steps on this walkthrough, but that one doesn't work either. The application installs, but the custom action doesn't run.

    It's a pretty straightforward walkthrough, I did it twice, and it doesn't work. Can somebody out there tell me if the walkthrough misses something or I am doing something wrong?

    It shows the warning message mentioned in this post , but that shouldn't be the problem.

    This is the first time I create a setup project. Until now I always used ClickOnce.

    Thanks,
    Stefano

    Wednesday, February 23, 2011 3:35 AM

Answers

All replies

  • Hi Stefano,

    I tested the walkthrough from MSDN, it is right and can work in my side (Visual Studio 2010 and .Net 4). You said it has the similar message with the thread: http://social.msdn.microsoft.com/Forums/en/winformssetup/thread/5167197a-12a5-473e-940a-569e92f08f37 Could you please try to check the "Launch Conditions" dialog, and check the .Net Framework version from the property panel?

    And by the way, I want to know if you have add custom actions for the four actions "Install" "Commit" "Rollback" and "Uninstall" all.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, February 24, 2011 9:13 AM
    Moderator
  • I tried again. I deleted the old project, went through the steps again, and again I got the same warning about the mismatching target versions.

    When I try to install the application installs (so it says, but I don't know how to test it) but nothing happens at the end. The Close button on the wizard is enabled, I click it and the installation ends.

    The OpenWeb class has the target framework (in advanced compiler settings) set to .NET Framework 4

    The Custom Action Installer has the prerequisite Microsoft .NET Framework Client Profile

    The .NET Framework launch condition is set to .NET Framework Client Profile

    If I change the 2nd and the 3rd to match the 1st then the warning message disappears. But after rebuilding and installing nothing happens.

    I added the custom actions Rollback and Uninstall, and I added the events AfterInstall, BeforeInstall, Committed and Committing (with the same line of code System.Diagnostics.Process.Start("http://www.microsoft.com") ), but the browser never started.

    I tried to install for everyone and for just me, I installed and uninstalled, but the browser never started.

     

    A few minor notes about the walkthrough:

    To add a deployment project

    Step 1: Before adding a new project i had to save

    Step 2: The dialog description doesn't match, but I found and selected the Setup Project template

    Step 4: It's OpenWeb, not OpenWeb3

     

    To add the custom action

    Step 3: I clicked OK


    Any Idea?
    Thanks,
    Stefano

    Friday, February 25, 2011 4:28 AM
  • Can you attach the project created on your computer, so I can try it on mine and look at the differences?

    Or can I attach my project for you to check if there is anything wrong?

    Saturday, February 26, 2011 11:42 PM
  • Why can't you just add the xla file to your setup project? Drag and drop from Explorer into the File System on Target Machine view?

     

    How do you know it's not running? The most likely explanation is that it is running fine but whatever you are doing to find the file and copy it isn't working. So exactly what code do you use to find the location of the file and exactly where do you copy it to? 


    Phil Wilson
    Sunday, February 27, 2011 6:57 PM
    Moderator
  • Problem with the walkthrough: I tried to create the project following the walkthrough, and it doesn't work: it should open a webpage after the installation, but it doesn't.

    Problem with my application: in my project I put a few MsgBox in the custom actions and in the events, but they never showed up.

    I want to check if Excel has an old version of the xla. There are 2 different old versions already distributed, with different names, and I want to see if they are installed, remove them and then install the new version distributed with my application.

    As a workaround I use ClickOnce to distribute the files, and every time the application talks to Excel checks if the latest version of the addin is installed, and if it is missing removes any old version and installs the new one.

    It works, but it doesn't look nice to me.

    Problem with custom actions in general: I would like to know how to use them, because I'm sure I will need them in the future. That's why I started with a very simple walkthrough.

    Thanks,
    Stefano

    Sunday, February 27, 2011 7:47 PM
  • Hi Stefano,

    Here is my simple for custom action: http://cid-51b2fdd068799d15.office.live.com/self.aspx/.Public/Samples%5E_2011/20110301%5E_SimpleCustomAction.zip it shows a simple message box after installing. Please try to test it.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, March 01, 2011 10:08 AM
    Moderator
  • Anyupdate?
    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, March 03, 2011 6:55 PM
    Moderator
  • I don't believe you can start a browser from a custom action as part of an "Everyone" type of install. The custom action will be running with the system account, that's the issue.  Apart from that, without seeing your code and what you do in case of an exception it's not possible to say what's going on.
    Phil Wilson
    Thursday, March 03, 2011 7:32 PM
    Moderator
  • Thanks for the example Bob. I tried it and it works.

    Comparing the files I find hundreds of differences, mainly because yours is in C# and mine in VB, but I couldn't tell where is the problem.

    Comparing the projects with Visual Studio, the content of every window, the properties of every object, etc., I cannot see any difference.

    Here is the result of my walkthrough.

    Would you be so wonderfully kind to check it and see if it works, and what is the problem?

    Thanks,
    Stefano

    Friday, March 04, 2011 12:47 AM
  • Hi Stefano,

    I tested your project, it can work. Same with my C# project.

    One suggestion, you could create an empty C# project that only contains the Install class. And you could set this C# project as the custom action output for your Setup project. Please test.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, March 04, 2011 9:55 AM
    Moderator
  • I used to work in C 25-30 years ago, but I never worked in C#.

    I tried to follow the wlakthrough in C# as you did, but it didn't work.

    At the end the Install item on the project menu is disabled.

    I tried to rebuild the solution, but that's still gray and I can't even try it.

    Here is my C# sample.

    Saturday, March 05, 2011 3:50 AM
  • Please specify the custom action for all items in the "Custom Actions" dialog, as:

     

    I have updated your sample, please check it: http://cid-51b2fdd068799d15.office.live.com/self.aspx/.Public/TestCase/20110307%5E_OpenWebCS%5E_TestCase.zip

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, March 07, 2011 1:34 AM
    Moderator
  • Doesn't make any difference: the Install item on the Project menu is still grayed out.
    Wednesday, March 09, 2011 12:13 AM
  • Could yo uplease try to check the setup porject file ".vdproj", it has the output folder settings. I think it is set as:

    "OutputFilename" = "8:Debug\\xxx.msi"  for debug and "OutputFilename" = "8:Release\\xxx.msi" for release.

    Please view these two folders, and try to find the setup file ".msi".

    On the other hand, do you develop this project in a limited protection folder? Please try to move this project to other folder, and build again. Any error from Output panel of Visual Studio, please share it. Thanks.

    Sincerely,


    Bob Bao [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Wednesday, March 09, 2011 9:23 AM
    Moderator
  • I removed the folders:

    OpenWebCS\bin
    OpenWebCS\obj
    Custom Action Installer\Debug
    Custom Action Installer\Release

    Then I opened the project, rebuilt the solution, rebuild Custom Action Installer, and the Project - Install item is now enabled.

    I also added the 4 items on the custom action editor, but at the end of the installation nothing happened.

    Is it possible for somebody to run the walkthrough in vb the way it is described?
    Thanks Bob for doing it, but you did it in C#, used different names, and there are other differences. So your result and mine are totally different, and I can't understand where is the difference.

    Or can you point me to another walkthrough?

    Thanks,
    Stefano

    Sunday, March 13, 2011 9:40 PM