开发者

How to get to commandline msdeploy from VS2010 web deploy

开发者 https://www.devze.com 2023-03-18 03:35 出处:网络
I have a project which I can deploy to 4 sites from within VS2010, 2 using file based deployment and 2 using web deploy.

I have a project which I can deploy to 4 sites from within VS2010, 2 using file based deployment and 2 using web deploy.

Its boring to sit through waiting for the deploys one after the other so I'd like to automate this. On the command line.

I know about msdeploy, but I can't see how to either tell it the same options which are in .Publish.xml or get it to use the settings which are saved there.

What I'd like is a batch file which looks something like

msbuild Project.sln /p:Configuration=Config1
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server1DeploySettings"
msbuild Project.sln /p:Configuration=Config2
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server2DeploySettings"
msbuild Project.sln /p:Configuration=Config3
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server3DeploySettings"
msbuild Project.sln /p:Configuration=Config4
magicDeployingProgram Project.sln /p:PublishXMLConfigurationName="Server4DeploySettings"

Or equivalent. I don't mind re-specifying the settings to msdeploy, but when I tried this I couldn't find the option to specify which IIS site to deploy to (the equivalent of the "Site/application" box on the publish settings dialog in vs2010).

Finally, I don't mind if it's web deploy only, my file-based deployment is a product of laziness, and I can set up a we开发者_开发百科b deploy agent on the appropriate box, I just haven't had to yet.

I've been searching for information about this, but it's pretty hard to find, I think.

Any pointers?


Ok, I think I've found this. msbuild can do it.

C:\path\to\project>msbuild 
     /p:configuration="Config1" 
     /p:DeployOnBuild=True 
     /p:DeployTarget=MsDeployPublish 
     /p:CreatePackageOnPublish=True 
     /p:DeployIISAppPath="Default Web Site or whatever" 
     /p:MsDeployServiceUrl="http://machine/MSDEPLOYAGENTSERVICE"
     /p:AllowUntrustedCertificate=true 
     /p:UserName=DOMAIN\user
     /p:Password=thePassword
     /p:MsDeployPublishMethod=RemoteAgent 
     /p:SkipExtraFilesOnServer=true

x4 in a batch file.

0

精彩评论

暂无评论...
验证码 换一张
取 消