# Friday, June 01, 2007
« global.asax could not load type | Main | Check for Serializable »
Found this in a comment on ScottGu's blog:

We use the web setup project to deploy our web applications. To automate additional installation tasks like setting the .NET version and encrypting the web.config files we use a custom installer along with the web setup project (see relevant code below). However we recently ran into a problem when deploying an application on a server where there are several web sites. The site we wanted to install on was not the default site. Therefore our code to set the .NET version and assign the newly created application pool did not work since "W3SVC/1/ROOT/" was not the correct path to the website. Is there a property similar to [TARGETDIR] which we can pass to our custom installer to account for this. We know hard-coding "W3SVC/1/ROOT/" was not the best option but we also knew it would be correct 90% of the time. Thanks as always for your time.

Best Regards,

Stephen

info = New ProcessStartInfo()

info.FileName = "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe"

info.Arguments = String.Format("-s W3SVC/1/ROOT/" & strVDir)

info.CreateNoWindow = True

info.UseShellExecute = False

Process.Start(info)

info = Nothing

Dim myApp As New DirectoryEntry("IIS://localhost/W3SVC/1/ROOT/" & strVDir)

myApp.Properties("AppPoolId").Item(0) = strMyAppPoolName

myApp.CommitChanges()

myApp = Nothing

# re: Using IIS with VS 2005 and the new Web Project system

Friday, January 12, 2007 2:00 AM by ScottGu

Hi Stephen,

You can pass in the targetsite and targetvdir path as context parameters to your custom action by passing this:

/targetdir="[TARGETDIR]\" /targetvdir="[TARGETVDIR]" /targetsite="[TARGETSITE]"

Comments are closed.