1

I'm currently using Setup Project in visual studio 2015. It works well except I'm having an issue with a particular necessity. After the installer finishes I need to run my .js file that registers my server on my application. Currently with Setup Project if I add my .js file to the "custom actions" in the install folder, when I run the installer it runs my file halfway in the setup. This is no good because the server isn't ready to be registered yet. I need this .js file to run AFTER installation. If anyone experience with Setup Project can help me out I'd be so thankful. However if anyone knows a better installer maker that can do what I'm asking for I'd be very interested in that too. Maybe WIX could do this for me?

PhilDW
  • 20,260
  • 1
  • 18
  • 28
J.Doe
  • 713
  • 1
  • 6
  • 19
  • You can add logic within installer class to execute the .js filer on after install. – Kurubaran Dec 02 '16 at 19:02
  • 1
    @Kurubaran Would you mind expanding a bit? What's this "installer class" you're talking about? Sounds like the right approach. – J.Doe Dec 02 '16 at 19:08

3 Answers3

1

This appears to be exactly what you need:

https://www.codeproject.com/articles/15800/calling-javascript-from-a-visual-studio-installati

This will give you more info about installer project custom actions:

https://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup-projects-and-custom-actions/

PhilDW
  • 20,260
  • 1
  • 18
  • 28
  • 1
    I described in my question why this approach doesn't work. But basically the issue is the custom actions > install folder executes my script in the middle of installation. I need it executed AFTER installation. – J.Doe Dec 05 '16 at 14:26
  • 1
    As I've said before in a related question, custom actions run from a Visual Studio installer extension setup do NOT run "in the middle", they run after all the files are installed, and it's really difficult to help you until you get past this misconception. All the files are installed when your CA runs, so it's another problem. – PhilDW Dec 05 '16 at 17:59
0

Add an Installer class to your set up project in visual studio. you can override many stages of installation within this installer class

EX:

  1. OnBeforeInstall()
  2. Install()
  3. OnAfterInstall()

You can override a relevant method and add logic within the method to execute the .js file.

You may have to get the directory where the MSI is being installed so that you can get the path of .JS file and execute it. following code should get the the installation directory. Add this code within the installer class.

string installationPath = Context.Parameters["assemblypath"];
radbyx
  • 9,352
  • 21
  • 84
  • 127
Kurubaran
  • 8,696
  • 5
  • 43
  • 65
  • I don't mean to be annoying or ungrateful but would you mind babying me through this? I right click my Setup Project and select "add > File..."? I don't see an option for add class. Also all my .js file is doing running a command prompt line. Would it be much easier to forget the .js file and have my installer write the command itself? If that's possible? – J.Doe Dec 02 '16 at 19:22
  • @J.Doe you need a add a class library to your solution and add installer class to that class library. – Kurubaran Dec 02 '16 at 19:56
  • will that conflict with my setup project? – J.Doe Dec 02 '16 at 20:35
  • no, once you implement the installer class you need to add the class library to installer's custom action. – Kurubaran Dec 03 '16 at 01:50
-1

Try the InstallShield 2013 with a limited warranty. It should be free for personal use, and it includes a functionality to run a script after the installation is completed.