Web Deployment Tool (MS Deploy)
MSDeploy Parameter Scope
Last post Jun 07, 2010 05:41 PM by hendricksend
Jun 04, 2010 05:47 PM|LINK
I have packaged up multiple applications using the appHostConfig provider of MSDeploy enabling AppPoolExtension to include the app pool. I am now trying to parameterize the application pool identity for each application using the DocumentObjectAttribute
parameter type. I have been able to do this successfully with a package containing a single application with the associated app pool using the following parameter:
<parameter defaultValue="testuser" name="UID">
<parameterentry type="DeploymentObjectAttribute" match="processModel/@userName" scope="processModel" />
I am hung up on how to do this when there are multiple app pools in the package. When I use the same parameter just the first identity is changed and I need to be able to set each independently.
Jun 05, 2010 01:49 AM|LINK
Try using a more complicated xpath match to limit yourself to the "right" application pool (you may also need to change your scope value). You can find free tools online to check your xpath matches (try searching "xpathvisualizer" for example) and get the
sample regex by doing a dump of your site (something like msdeploy -verb:dump -source:apphostconfig="mySite" -enableLink:apppoolextension -xml > c:\tempFile.txt). Here's also a good page for xpath examples:
An xPath like this would target the userName attribute for processModel but only under appPoolConfig nodes with appPool="DefaultAppPool", so you can target the setting by application pool name:
Jun 07, 2010 01:21 PM|LINK
The xpath query I am using is valid so it appears the scope value is the issue. I have tried using several values (application, appHostConfig, appPoolConfig.*, .*) for the scope using the data from the dump file but can only get the parameter to work if
I set the scope value to the element of the attribute I am trying to change (i.e. processModel in this case). My regular expression skills are lacking but I would expect to be able to use .* for the scope and then the appropriate xpath query to target the
Jun 07, 2010 04:48 PM|LINK
Can you give the exact command that you are using?
Jun 07, 2010 05:41 PM|LINK
Below is the parameters file I have created. I have set the defaultValue of the userName attribute to a different value than what was set when the package was created so that I can easily test without the need of the setParameters.xml file.
<parameter name="UID" defaultValue="testUser">
<parameterEntry kind="DeploymentObjectAttribute" scope=".*" match="//appPoolConfig[@appPool="DefaultAppPool"]//processModel/@userName" />
Here is the msdeploy command I am using to deploy the package: msdeploy -verb:sync -source:package=package.zip,encryptPassword=**** -dest:auto,computername=comp1
I know the command is correct and the parameters files is valid because it works if I change the scope to processModel and match to processModel/@userName. Where I run into problems is targeting the correct userName attribute when the package contains multiple
application pools. I believe this is an issue with the scope value I am setting.