为使用TeamCity中的FileSystem部署的MSBuild发布步骤提供凭据

时间:2013-11-21 16:26:24

标签: visual-studio-2012 msbuild continuous-integration teamcity

我在开发环境中工作,其中计算机不属于域。我正在尝试在其中一台计算机上设置TeamCity 8.05,以便为我们的QA团队发布签到测试服务器。当我部署到TeamCity服务器上的本地目录时,我按照我想要的方式工作,但是当我尝试发布到QA服务器时,我遇到了权限问题。我在QA服务器上分享了一个本地用户,我想在发布时进行身份验证。这可能与MSBuild一起使用吗?

命令行切换到TeamCity中的MSBuild运行器,如下所示:

/p:PublishProfile=./Alpha.publish /p:DeployOnBuild=true 
/p:Configuration=Alpha /p:VisualStudioVersion=11.0 
/p:UserName=QAServer\BuildUser /p:Password=somepass

Alpha.publish文件如下所示:

<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <LastUsedBuildConfiguration>Alpha</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <SiteUrlToLaunchAfterPublish />
    <LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
    <ExcludeApp_Data>False</ExcludeApp_Data>
    <publishUrl>\\QAServer\Alpha</publishUrl>
    <DeleteExistingFiles>True</DeleteExistingFiles>
    <PrecompileBeforePublish>True</PrecompileBeforePublish>
    <EnableUpdateable>True</EnableUpdateable>
    <DebugSymbols>False</DebugSymbols>
    <WDPMergeOption>DonotMerge</WDPMergeOption>
  </PropertyGroup>
</Project>

当此步骤运行时,我收到'访问路径\\ QAServer \ Alpha被拒绝'消息。我假设这是因为构建代理作为系统帐户运行,无法访问QAServer。

我正在努力避免使用Web Deploy的开销,但如果无法实现,则it looks like that would work for me

1 个答案:

答案 0 :(得分:3)

来自Sayed I. Hashimi的推特:

  

FileSystem依赖于windows auth。传入密码将被忽略。   您的构建用户需要写入权限

这就是我的想法。我的解决方案是首先发布到本地登台目录,然后使用SMB Deployer from the TeamCity Deployer plugin在网络上移动文件。该插件允许您指定凭据。