Click here to Skip to main content
15,893,381 members
Articles / Operating Systems / Windows
Tip/Trick

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

Rate me:
Please Sign up or sign in to vote.
4.50/5 (2 votes)
28 Aug 2011CPOL1 min read 18.1K   2   3
Lets you predefine the app pool

Introduction


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.


Background


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 :


C:\Windows\SysWOW64\Cscript.exe

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


c:\WiRunSQL.vbs

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.


$(BuiltOuputPath)

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:


SQL
"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!

License

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


Written By
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.

Comments and Discussions

 
QuestionSeems to corrupt VS2010 .MSI package! Pin
Mark Ward12-Oct-11 4:57
Mark Ward12-Oct-11 4:57 
AnswerRe: Seems to corrupt VS2010 .MSI package! Pin
Wolfeye12-Oct-11 6:55
Wolfeye12-Oct-11 6:55 
GeneralRe: Seems to corrupt VS2010 .MSI package! Pin
Mark Ward12-Oct-11 15:28
Mark 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.