How to create an installer than runs a file after install? - c#

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?

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/

Add an Installer class to your set up project in visual studio. you can override many stages of installation within this installer class
EX:
OnBeforeInstall()
Install()
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"];

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.

Related

Merge Multiple (setup) Files into Single Setup

I have a project (Outlook desktop add-in) in the following stack:
C#
Dot net pre-requisite 4.5.2+
When I build the application, I get a setup folder of 3 files/folders:
setup.exe
project-vsto.vsto
Application Files - folder with dll.deploy and manifest files
When I run this exe manually, I can see the installation in my control panel and things work fine.
Now, for mass deployment purposes, I package this folder using advanced installer, through which I create a packaged msi of the project.
On manual installation of this msi, it does 2 things:
"Installs" the packaged project. It can be seen in the control panel. However, this is not the actual thing, more like extraction of files in "C:\program-files..." and we need to run the "setup.exe" here.
Runs the setup.exe, as it is mentioned in the exit dialog at the time of msi creation. This is actual project installation step.
However, when I deploy this through SCCM or GFI (Languard) (which we will be using for mass deployment), second step does not follow. What is the work-around through this?
Is there any thing in advanced installer which I can do to omit step-1? I have read docs etc but could not find other than doing this through custom actions or exit dialog (I've tried both, obvs) which behave in same way as far as my situation is concerned.
Or,
Can I tweak some setting in SCCM or GFI (maybe add custom action there, or some installation switch, or some other setting?!!) which can help me achieve my purpose.
Any leads which can help my cause will be greatly appreciated. Thanks in advance.
Most likely you didn't use the built-in support Advanced Installer has for Office addins.
Here it is a video tutorial about how to create a setup package for an Office Addin with Advanced Installer:
Package Office addin with Advanced Installer
Try to follow these steps and check the outcome.

Install Shield msi file installing to the wrong directory (error 1309)

I am using Visual Studio 2013/ISLE to create a C# program with a .msi install image. When I run install from VS the program is installed in the expected location, e.g. c:/Program Files (x86)/...
I'm sure that this is something simple but I can't figure it out. A pointers would be greatly appreciated.
When you run a 32-bit installer in x 64-bit system Windows will always redirect your installer writing to c:\Program Files to c:\program files (x86). If you want to install to the non-x86 folder you will need to provide a 64-bit installer for your application.
This blog post explains why Windows does this.
It looks like InstallShield LE will allow you to write to the correct folder when your project is set to AnyCPU, but for more advanced scenario's you'll need to use the Pro version or the free Wix installer.
I assume the question is why the installation MSI fails when you run it outside of Visual Studio, but works when VS launches it?
If yes, you should first check if your ISLE project is creating an MSI or an EXE bootstrapper (that also contains the MSI). If an EXE is created this is what you should launch manually, not the MSI. In theory, a bootstrapper can act like an initialization support for the MSI and specify default values for certain properties, like an installation folder, etc...
I say in theory because I am not very familiar with ISLE, I work with other setup authoring tools, thus cannot say for sure if this stands for ISE projects too.

Delete specific files after installation using visual studio setup project

I have this problem. I want to build an installer for my c# solution, that will be placed in a folder with other installation folders and files that are needed to be copied to the installed folder. So that is easy, I just copy them to the folder I create using the folder structure I want.
Now, I want also to install another program and run a .exe file I've created to unzip some files for me. For that I need to copy 2 .exe files and 2 dlls (for the exes) to the folder to which I am installing and create 2 custom actions that will use them. That I've managed to do.
After that I want to delete those 4 extra files, as the user does not need them and shouldn't even be aware they are there. How to do so? I couldn't find a way in the built in setup project preferences + I do not know how to make a custom installer class.
A bonus question, is how to make the other installer (one of the .exe files is just a plain installer) install quietly to any path? I do not want the user to see an installer pop out of my program installer.
Thanks!
Some commercial setup authoring tools support temporary files. They are extracted when the installation starts and automatically removed when the installation ends. They are never registered with Windows Installer.
You can find a list of setup tools here:
http://en.wikipedia.org/wiki/List_of_installation_software
Regarding the prerequisite, it depends on its setup package. You can install it silently only if it supports this through its command line.
Don't. You will get a ton of problems with Windows Installer trying to automatically repair your applications and such things. You might be able to solve the problem with a more advanced installer creator, such as WiX.

How to run setup (*.exe) file with out using MSI File?

Here I have successfully create setup using visual studio 3.5. On Debug folder in application I found (*.exe and *.msi file).
When I have take both file in same folder then it's work fine. But when I have take only (*.exe) file then it doesn't work.
I need to run (.exe) setup with out using (.msi) file. I required to send only *.exe to client.
Is there any way to wrap both file in to single file.
Thanks In advance :)
You have it the wrong way around! The MSI is the important but, the .exe is just a bootstrapper that calls the MSI. If anything you could just distribute the MSI.
See What does the EXE do in the Visual Studio setup project output?
It should be possible to create a bootstrapper that includes the actual MSI as an embedded resource, however I'm not sure how you can do this using Visual Studio.
If I were you I would either just distribute the MSI on its own with the instructions that users must have the .Net framework installed in order for the application to run, or combine up the two in a self-extracting zip (or similar).
http://hmne.sourceforge.net/
here you can find the HMsoft NISeditor, this program works as follows:
Run program
Choose setupname
add all .DLL and .exe files of your project
create the setup

Configuration file 'C:\my\App.Config' is being used to configure all executables

I have a Visual Studio setup project that installs an application into the task scheduler and also installs a GUI application to manage some configuration parameters in the registry. This being the case, the setup project installs two different primary outputs (.exe's) as part of the process.
I am getting the following warning when I rebuild the setup project:
Configuration file 'C:\my\App.Config'
is being used to configure all
executables
Is there any way to remove this warning? The suggested MSFT solution apears to be to use a different setup project for each .exe, but I only want the users to have to run one installer. Any suggestions?
There was a <runtime> section in my App.Config file and once I removed this portion of the config file the issue went away.
Maybe you could create an installer that launches all the other installers.
This isn't a particularly helpful on microsofts part is it?
Another idea might be to take their advice and use either no config file or a custom file format so that you avoid this error.
From Choosing a Windows Installer Deployment Tool, it looks like the built-in windows installer maker is essentially deprecated ("Future versions of Visual Studio will not include the Visual Studio Installer project templates.")
This page also recommends InstallShieldLE and Windows Installer XML Toolset. I've just used InstallShieldLE to create an install that includes multiple executables and it appears to have worked (I'll edit this if it turns out it didn't work).
For very complicated installs, I've used NSIS in the past with great success - I'm not sure how much extra effort NSIS requires over InstallShieldLE for simple installs.

Categories

Resources