Click here to Skip to main content
12,885,784 members (37,039 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


2 bookmarked
Posted 26 Aug 2011

Post-build event to select the default app pool for a web project

, 28 Aug 2011 CPOL
Rate this:
Please Sign up or sign in to vote.
Lets you predefine the app pool


I recently needed to modify an installation MSI for a website deployment. The "Installation Address" dialog box for a website install doesn't allow customization except for the bitmap, which isn't particularly useful. I needed to modify the default app pool to prevent installation problems.


There are several ways to do this. You can use Orca to open the MSI file and add the property. You can use msiexec.exe from the command line and specify what property you want set. What I wanted was to create a standalone MSI file that did this automatically when the MSI was run.

Using the code

The solution I came up with is to add a post-build event to the setup project. To do this, you'll use Cscript and WiRunSQL.vbs.

The first step is to find Cscript.exe, which for me was located in :


The second step is to find WiRunSQL.vbs which I put in C:\ for simplicity:


To construct the MSI, use the following code to get the correct output. It adds the filename by itself so it's really the path + filename. No need to specify the name of the MSI file.


The last part you'll need is the insert command itself. All the punctuation marks are required. Also keep in mind that the only part you'll need to change is the underlined part:

"INSERT INTO `Property` (`Property`,`Value`) VALUES ('TARGETAPPPOOL','TheAppPoolName you want to use')"

Points of Interest

The final step then is to string these four items together into one command, which will look like:

C:\Windows\SysWOW64\Cscript.exe c:\WiRunSQL.vbs $(BuiltOuputPath) "INSERT INTO `Property` (`Property`,`Value`) VALUES ('TARGETAPPPOOL','TheAppPoolName you want to use')"

Pretty simple once you know how to do it, but it's the learning part that's hard. I hope that you find this useful!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Web Developer
United States United States
I've been a hack programmer for years, working with Delphi, C++, VB.NET, and C#. I know enough to be very dangerous but not enough to be promotable.

You may also be interested in...

Comments and Discussions

QuestionSeems to corrupt VS2010 .MSI package! Pin
Mark Ward12-Oct-11 4:57
memberMark Ward12-Oct-11 4:57 
AnswerRe: Seems to corrupt VS2010 .MSI package! Pin
Wolfeye12-Oct-11 6:55
memberWolfeye12-Oct-11 6:55 
GeneralRe: Seems to corrupt VS2010 .MSI package! Pin
Mark Ward12-Oct-11 15:28
memberMark Ward12-Oct-11 15:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 28 Aug 2011
Article Copyright 2011 by Wolfeye
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid