【发布时间】:2013-11-30 15:27:20
【问题描述】:
我一直在使用 TeamCity 来建立并运行 CI 环境。
我开始关注 Troy Hunt 的 'You're deploying wrong',这非常有用,但是我想将打包和部署分成 2 个单独的步骤,原因如下:
- 我想将一些额外的标志传递给 msdeploy,但使用 Troy 描述的 MSBuild Package and Deploy 是不可能的(据我所知)。
- 如果我需要构建包但不部署它,我可以轻松禁用第二个构建步骤,即部署。
- 我想在 msdeploy 上使用 -skip 标志来防止它删除某些文件夹,但如果不将其作为参数传递给命令行,我也找不到任何方法。
所以,在我的第一个 MSBuild 步骤中,我只有参数:
/P:Configuration=%env.Configuration%
/P:VisualStudioVersion=11.0
/P:IgnoreDeployManagedRuntimeVersion=True
然后我有第二个构建步骤,它使用命令行构建运行程序执行以下 msdeploy 命令:
"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:package="C:\ProgramData\JetBrains\TeamCity\system\artifacts\MyProject\%system.teamcity.buildConfName%\%teamcity.build.id%\MyProject.Web.csproj.zip" -dest:auto,ComputerName='https://devserver:8172/msdeploy.axd?site=MyWebsite',UserName='domain\username',Password='password',IncludeAcls='False',AuthType='Basic' -skip:objectName=dirPath,absolutePath=media$ -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -retryAttempts=2 -allowuntrusted
问题在于,TeamCity 在所有构建步骤完成之前显然不会发布工件,因此命令行过程失败,因为此时包 zip 文件实际上并不存在。
我读过一些关于 publishing artifacts whilst the Build is still in progress 的文章,但这似乎有点不合时宜。
任何建议将不胜感激。
【问题讨论】:
标签: msbuild teamcity msdeploy teamcity-8.0