无法上传目录:MSBuild和Jenkins问题

时间:2011-12-14 16:20:43

标签: c# msbuild ftp jenkins

我花了一整天时间与一个我无法解决的问题作斗争。问题是我正在将Jenkins CI环境移动到另一台服务器,并在Jenkins中创建另一个工作来处理实时部署。实时部署发生在新服务器而不是开发服务器上。我在这个过程结束时遇到了问题。

部署到UAT的输出是:

GenerateSampleDeployScript:
  Sample script for deploying this package is generated at the following location:
  C:\Builds\Mcfc\Service\UAT\Mcfc\Build\WebServices\FulfillmentWebService\obj\UAT\Package\FulfillmentWebService.deploy.cmd
  For this sample script, you can change the deploy parameters by changing the following file: 
  C:\Builds\Mcfc\Service\UAT\Mcfc\Build\WebServices\FulfillmentWebService\obj\UAT\Package\FulfillmentWebService.SetParameters.xml
Done Building Project "C:\Builds\Mcfc\Service\UAT\Mcfc\Build\WebServices\FulfillmentWebService\FulfillmentWebService.csproj" (Package target(s)).
Done Building Project "C:\Builds\Mcfc\Service\UAT\Mcfc\scripts\main.xml" (Transfer target(s)).

Build succeeded.

但是要实现的部署会返回:

GenerateSampleDeployScript:
  Sample script for deploying this package is generated at the following location:
  C:\Builds\Mcfc\Service\Production\Mcfc\Build\WebServices\FulfillmentWebService\obj\Production\Package\FulfillmentWebService.deploy.cmd
  For this sample script, you can change the deploy parameters by changing the following file: 
  C:\Builds\Mcfc\Service\Production\Mcfc\Build\WebServices\FulfillmentWebService\obj\Production\Package\FulfillmentWebService.SetParameters.xml
Done Building Project "C:\Builds\Mcfc\Service\Production\Mcfc\Build\WebServices\FulfillmentWebService\FulfillmentWebService.csproj" (Package target(s)).
C:\Builds\Mcfc\Service\Production\Mcfc\scripts\Production.xml(143,5): error : CDUP successful. "/Mcfc/Production/SOA/AuctionWebService" is current directory.
C:\Builds\Mcfc\Service\Production\Mcfc\scripts\Production.xml(143,5): error : 
C:\Builds\Mcfc\Service\Production\Mcfc\scripts\Production.xml(143,5): error : Couldn't upload directory.
Done Building Project "C:\Builds\Mcfc\Service\Production\Mcfc\scripts\Production.xml" (Transfer target(s)) -- FAILED.

Build FAILED.

部署脚本的相关部分如下:

142 <Target Name="Transfer" DependsOnTargets="Package">
143    <FtpUploadDirectoryContent
144    ServerHost="secret"
145    Port="21"
146    Username="secret"
147  Password="secret"
148    LocalDirectory="$(LocalBuild)\WebServices\AuctionWebService\obj\$(Configuration)\Package\PackageTmp"
149    RemoteDirectory="Mcfc/$(Configuration)/SOA/AuctionWebService"
150    Recursive="true"
151     />

我整天都遇到了这个问题,所以非常感谢所有的帮助。

谢谢,

萨钦

1 个答案:

答案 0 :(得分:1)

尝试将最后一个斜杠字符附加到LocalDirectory属性值,如下所示:

LocalDirectory="$(LocalBuild)\WebServices\AuctionWebService\obj\$(Configuration)\Package\PackageTmp\"

您还可以尝试重新编译FtpUploadDirectoryContent任务,以便在记录异常时包含堆栈跟踪以获取更详细的错误消息。