I'm trying to deploy website with MSDeploy and team build using some of this ...
/p:DeployOnBuild
/p:DeployTarget=MsDeployPublish
/p:CreatePackageOnPublish=True
/p:MSDeployPublishMethod=InProc
/p:MSDeployServiceURL=localhost
/p:DeployIISAppPath="Default Web Site"
Is there a way to set this website in custom application pool?
Part of the trick is with
/p:IncludeAppPool=true
. That changes the deploy script to enable AppPoolExtension. But I haven't figured out how best to actually set the app pool yet. :)If you're using IIS 7, you can use the appPoolProvider to sync application pools to a remote server. See:
http://technet.microsoft.com/en-us/library/dd569070(WS.10).aspx
and
http://blog.torresdal.net/2010/08/16/NoClickWebDeploymentPart2WebDeployAkaMsdeploy.aspx
However, I wasn't able to really get that to work well, and if you're using IIS 6 this won't work anyway. What you can do though is leverage MSDeploy to run a couple commands on the remote server to set the application pool (and register the .NET version on the website).
First, create a batch file that contains something similar to the following:
So, if the IIS number is 1, your virtual directory is "MyDirectory" and the App Pool is named ".NET4.0", the command would be.
You can then run MSDeploy, passing this batch file in as an argument and running it on the remote machine:
where
<path to batch file>
is the full path to the batch file you just created above, and is the computer against which you want to run this. Here is a link describing therunCommand
argument: http://technet.microsoft.com/en-us/library/ee619740(WS.10).aspxI'm sure you can set this up as a build step in TFS. We made a little .NET utility that we call as part of our deployment process that creates these batch files and runs the MSDeploy command.
There are also other things you can do in this same method that might prove useful to you:
Register an IIS version:
Create an App Pool:
Thanks to http://justsamson.com/2010/06/14/create-virtual-directory-in-iis-6-0-via-command-line/ for the command-line scripts to do the various functionality.