Click here to Skip to main content
Click here to Skip to main content

Tagged as

Go to top

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

, 28 Aug 2011
Rate this:
Please Sign up or sign in to vote.
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:

"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)

Share

About the Author

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

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 28 Aug 2011
Article Copyright 2011 by Wolfeye
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid