• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3051
  • Last Modified:

MSI Installer Visual Studio 2010 - Batch File / EXE

Hi All,

I have made a setup project using Visual Studio 2010 and it worked fine for what I need it to do. However, a requirement has come that before the installer installs my program, I need it run a batch file. For ease of life this batch file has been converted to an EXE also, so either the batch file can run, or the EXE, whichever is the easiest to run or program in.

How can I do this? It must run before the installer begins to install my program, not during or after, it must be before.

Thanks,

Ibs
0
ibrafiqb
Asked:
ibrafiqb
  • 4
  • 4
  • 2
4 Solutions
 
Julian HansenCommented:
Build a wrapper installer that runs the exe / bat first and then runs your install.
0
 
ibrafiqbAuthor Commented:
Can someone explain the steps required to build a wrappe installer?
0
 
Julian HansenCommented:
Same as building a normal installation - just include the exe and your install and set it up so  that the exe runs first.
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
ibrafiqbAuthor Commented:
Hi Julian,

What I have done is right clicked my Installer Project, Add File - Selected my batch file. What do I do now? Sorry I am not very familiar to this aspect in Visual Studio.
I have attached a screenshot.
Screenshot.jpg
0
 
Julian HansenCommented:
Build your msi for your application

Create a new installation project.
Add your msi and the exe to that project.

Create a custom action to run at the end of the new installation to run the EXE and then to run your .msi to do the actual install.

Google custom action VS2010 installer to find out more on how to do this if you are not familiar with custom actions.
0
 
Vadim RappCommented:
If you need to run your batch file before the installation, you can't accomplish it within Visual Studio setup project. Even if you create what's called 'custom action" within the installation, Visual Studio allows you to run it only after the installation has finished. There's no way to do it before.

You have two options:

1. use more capable installation-authoring tool, such as Installshield or Wise, that allows putting custom actions in any place, including in the beginning of the installation. If you have limited experience or budget for these tools, consider hiring someone. Many experts on E-E have contact information in their profiles and will be happy to help.

or

2. leave the installation alone, but run this batch file when you deploy it - which depends on how you deploy it. For example, if it's by logon script in the group policy, then all you have to do is call batch file from the script. Another way is building wrapper .exe, as others have suggested.
0
 
Julian HansenCommented:
Just to clarify:

 you can do this if you contain the original installation in a new installation and have the custom action run after install

1. Installation 1 runs and puts the following on the machine

  precursor.exe
  installation2.msi

2. Custom action runs

   precursor.exe

   and then runs installation2.msi which does the actual install.

I just want to distinguish between my suggestion above and what vadimrapp1 said in the post above.
0
 
ibrafiqbAuthor Commented:
The actual end way I did it was via a self extracting exe, which silently runs the uninstaller before extraction.
0
 
ibrafiqbAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for ibrafiqb's comment #a38324083

for the following reason:

The only way to do it.
0
 
Vadim RappCommented:
Self-extracting exe is nothing but one form of the wrapper, which we suggested. And certainly it's not the only way to do it, it's just what the author chose.

Split between

http:#a38300034
http:#a38300370
http:#a38300491
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 4
  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now