Wednesday, April 28, 2010

Deploying Custom made Visual Studio prerequisites using Bootstrapper Manifest Generator

Do you want your setup installer install Software 'X' before the actual program is installed, using Visual Studio Development?

The Software 'X' is called a prerequisite and can be Java Run Time, DirectX, 3rd party plugin installation etc.

Checker >> There are in-built prerequisite supported by Visual Studio. Open a Setup and Deployment project in Visual Studio... From the menu, select Project >> Properties...; or Hit Alt + F7.

Select Prerequisites...

Now, you would see a list of prerequisites listed here.

You can add a custom prerequisite of your choice. Here is how to do it,

Things to download:
1) Bootstrapper Manifest Generator (BMG)

Click here to download.

2) I want to create a prerequisite fir Visual J# 2.0. I have downloaded the required setup files for 32-bit and 64-bit.

32-bit
64-bit

Instructions:
1) Install BMG, Visual J# 32-bit and 64-bit.

2) Open BMG, create a new file. Select Package Manifest...

3) Rename the Product name, Product Code to Visual J

4) I have to install the particular version of Visual J# based on the OS bit version and if it is installed. To accomplish this, I have made some Install checks and OS checks. Please read about registry checks if you need to install software based on the existing version.

Select the System Checks tab and select the MSI product check... As you have already installed the 32-bit and 64-bit Visual J#, you will find them in this list. Name them with a property which you will be using in future.

5) Add Install File... Browser to the downloaded Visual J# 32-bit and 64-bit .exe files.
Select vjredist.exe. Rename the Display Name. Select Install Conditions...

Add these two conditions...
BypassIf >> ProcessorArchitecture = AMD64
BypassIf >> VJInstall > 2


this means you want to skip this installer if the OS is 64 bit and Visual J is already installed (> 2).

Select the Exit Codes and set them..
0 >> Success
1641 >> Success, Reboot Needed
3010 >> Success, Reboot Needed

Similarly select conditions for vjredist64.exe

Add these two conditions...
BypassIf >> ProcessorArchitecture = AMD64
BypassIf >> VJInstall > 2

Set the same Exit Codes as before..

6) Save and the Package Manifest file and build it...

7) Go to Document and you will find a folder named Visual J. Copy this folder to C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages .

8) Repeat Checker and now you will find the Visual J here. Select it. Uninstall Visual J# 32 - bit and 64 - bit. Trying running the setup file after you compile your Visual Studio project. The installer detects you do not have Visual J and gives your an option to install.

Cheers.

2 comments:

Sagar Kapadia said...

Thanks a lot. I had been struggling with this for a couple of days now

Unknown said...

link to download BMG doesn't work. Can you provide a new download link?