locked
Automating web deployments from TFS Build 2011

    Question

  • Hi all,

    I'm trying to automate web deployment from a tfs 2011 build server but for some reason, the publish files aren't generated and the deploy is not happening.

    * When I publish the website on my local machine, from visual studio, everything works.

    * When I call the generated publish cmd file, everything works. 

    * when I call msbuild locally on my project, with the flag /P:DeployOnBuild=true It generates the publish command files normally. 

    However, on the build server, the publish tasks aren't executed so the publish cmd files aren't generated. 

    I've tried (many variations of) the following parameters:

    /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=False /p:MSDeployPublishMethod=RemoteAgent /p:AllowUntrustedCertificate=True /p:MSDeployServiceUrl="[server]" /p:DeployIisAppPath="default web site/myproject" /p:UserName=[user] /p:Password=[password]

    any other hints?

    thanks,

    Erwin van der Valk

    Freelance software architect, developer and consultant

    Wednesday, May 09, 2012 10:15 AM

Answers

  • Hi Erwin,  

    Thanks for your reply. 

    The /p:DeployOnBuild=True argument use for Web packaging. 

    For Web publishing, we need to specify other arguments in MSBuild Argument:

          /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=InProc

         /p:MSDeployServiceUrl=localhost /p:DeployIisAppPath="Default Web Site/NewOrleansJazz" /p:UserName=domain\user /p:Password=myPassword

    To perform web deployment using Team Build, please refer the more information in this article: http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html.   


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, May 11, 2012 8:36 AM

All replies

  • Erwin,

    It seems someone had similar issue and it got resolved.

    http://stackoverflow.com/questions/9363497/difference-between-msbuild-with-deployonbuild-and-visual-studio-publish


    Regards,
    Adhi
    My TFS Blog
    Please remember to mark as answered, if this reply helps

    Wednesday, May 09, 2012 4:59 PM
  • Hi Adhi,

    Thanks for the reply. Unfortunately that's not the problem.

    This user reports that publishing through msbuild doesn't work and he get's an exception.

    Publishing through msbuild works on my local dev machine, it just doesn't work in a team build. But I don't get any exception. It just looks like the publish task doesn't get executed even though it should.

    thanks,

    erwin

    Wednesday, May 09, 2012 5:32 PM
  • Hi Erwin, 

    Thanks for your post. 

    Have you tried to build your project using MSBuild manually on build agent machine, with the flag /P:DeployOnBuild=true, it generates the publish command files correctly?

    Try to publish a simplest Website project using your Team Build, still can’t work?   


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 10, 2012 6:50 AM
  • Hi John,

    Thanks for your reply.

    When I run msbuild on the project with the /p:deployonbuild flag on the server, it does nothing. It is already the simplest website you could hope for.

    One thing to note: we have not installed visual studio on the build server. Is that a requirement for this to work?

    thanks,

    Erwin

    Thursday, May 10, 2012 7:07 AM
  • Hi Erwin, 

    Thanks for your reply. 

    Yes, we usually suggest to install the VS on build machine. Please install it and try to run MSBuild with the /p:deployonbuild flag on build machine again.         


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, May 10, 2012 7:25 AM
  • Hi John,

    So the good news is, now it does build the deployment zip file. Unfortunately, it doesn't perform the web deploy.

    How can I get it to actually perform the deploy?

    thanks,

    Erwin

    Thursday, May 10, 2012 9:29 AM
  • Hi Erwin,  

    Thanks for your reply. 

    The /p:DeployOnBuild=True argument use for Web packaging. 

    For Web publishing, we need to specify other arguments in MSBuild Argument:

          /p:DeployOnBuild=True /p:DeployTarget=MsDeployPublish /p:CreatePackageOnPublish=True /p:MSDeployPublishMethod=InProc

         /p:MSDeployServiceUrl=localhost /p:DeployIisAppPath="Default Web Site/NewOrleansJazz" /p:UserName=domain\user /p:Password=myPassword

    To perform web deployment using Team Build, please refer the more information in this article: http://vishaljoshi.blogspot.com/2010/11/team-build-web-deployment-web-deploy-vs.html.   


    John Qiao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, May 11, 2012 8:36 AM
  • Hi John,

    I tried with /p:DeployOnBuild=True to create a deployment package .zip file (database project included) and got following error message during build on TFS11:

    C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v11.0\Web\Microsoft.Web.Publishing.targets (3399): Web deployment task failed.(Object of type 'dbFullSql' and path 'Data Source=(localdb)\Hdi_Wizball;Initial Catalog=Hdi.Wizball.Server.Database;Integrated Security=True;Application Name=EntityFramework' cannot be created.)

    Object of type 'dbFullSql' and path 'Data Source=(localdb)\Hdi_Wizball;Initial Catalog=Hdi.Wizball.Server.Database;Integrated Security=True;Application Name=EntityFramework' cannot be created.

    Cannot connect to the database 'Hdi.Wizball.Server.Database'.

    Exception has been thrown by the target of an invocation.

    Failed to connect to server .

    Cannot open database "Hdi.Wizball.Server.Database" requested by the login. The login failed.

    Login failed for user 'HIA\tfsuser'.


    mikeeagleeye

    Friday, July 13, 2012 11:44 AM