How do I deploy/publish a Web Application with CruiseControl.NET & MSBuild?

一曲冷凌霜 提交于 2019-12-21 12:31:08

问题


How do I deploy/publish a Web Application with CruiseControl.NET & MSBuild? I am new to CCNET and I able to get it to get the latest source from SVN and Build with MSBuild 3.5. How do I get the site to publish to another (DEVELOPMENT) server? Thanks for any pointers/examples.

Cheers, ~ck


回答1:


For publishing web sites to a development server after it is build on my CI server in CruiseControl.NET, I use Microsoft Web Deploy. It requires that you install the deployment service on any servers that will be deployment targets. Then you can simply add an execute step to your build process that runs msdeploy.exe. Here is an example I use in NAnt:

        <exec program="C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy.exe">
        <arg value="-verb:sync"/>
        <arg value="-source:dirPath=&quot;${tmpdir}&quot;"/>
        <arg value="-dest:dirPath=&quot;${deploy.dir}&quot;,computerName=http://${servername}/msdeploymentservice/"/>
    </exec>

By using Web Deploy, you can easily do a complete sync of the web site contents removing things that should not be there as well. It also has other options to do things like ignore certain directories and issue commands to recycle app pools, etc.




回答2:


My solution for CCNET with the Web.config transformation:

<tasks>
    <msbuild>
        <executable>C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe</executable>
        <workingDirectory>E:\VersionesCC\Trunk_4\SBatz\Gertakariak_Orokorrak\GertakariakMS\Web</workingDirectory>
        <projectFile>GertakariakMSWeb2.vbproj</projectFile>
        <targets>Build</targets>
        <timeout>600</timeout>
        <logger>C:\Program Files\CruiseControl.NET\server\ThoughtWorks.CruiseControl.MSBuild.dll</logger>
        <buildArgs>
            /noconsolelogger /p:Configuration=Release /v:diag
            /p:DeployOnBuild=true
            /p:AutoParameterizationWebConfigConnectionStrings=false
            /p:DeployTarget=Package
            /p:_PackageTempDir=E:\Aplicaciones\GertakariakMS2\Web
        </buildArgs>
        </msbuild>
</tasks>



回答3:


I typically use the Build Publisher task to deploy files onto remote servers. You could also write a script with an xcopy command to deploy as well.




回答4:


You can use Web Deployment Projects to help with this as well. In the WDP you can use the ExcludeFromBuild item to exclude those files. For more info see http://msdn.microsoft.com/en-us/library/aa479568.aspx.

This would handle the site to get pre-compiled for you to then publish to another dev server, this depends on how you deploy now. If you copy to network share or ftp then you can do those with MSBuild as well. I'm not familiar with the Build Publisher that the previous answer mentions.




回答5:


I found this blog very useful. Essentially you point the ccnet.config file to a MSBuild.xml file that you create in your project directory. Within the MSBuild.xml file you create a target which will build and publish the web application using the _CopyWebApplication option



来源:https://stackoverflow.com/questions/1297701/how-do-i-deploy-publish-a-web-application-with-cruisecontrol-net-msbuild

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!