TFS Express 2012构建失败

时间:2016-07-19 08:27:08

标签: tfs msbuild tfs2012 access-denied

我有一个在TFS 2012 Express中托管的VS解决方案,其中包含Build系统(服务,控制器,代理)。我还使用此构建项目文件作为目标创建了构建定义:

    <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0"
         DefaultTargets="Build"
         xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
    <OutDir Condition=" '$(OutDir)'=='' ">$(MSBuildThisFileDirectory)bin\</OutDir>
    <Configuration Condition=" '$(Configuration)'=='' ">Release</Configuration>
    <SourceHome Condition=" '$(SourceHome)'=='' ">$(MSBuildThisFileDirectory)</SourceHome>
    <ToolsHome Condition=" '$(ToolsHome)'=='' ">$(MSBuildThisFileDirectory)tools\</ToolsHome>
  </PropertyGroup>

  <ItemGroup>
    <Solution Include="$(SourceHome)*.sln">
      <AdditionalProperties>OutDir=$(OutDir);Configuration=$(Configuration)</AdditionalProperties>
    </Solution>
  </ItemGroup>

  <Target Name="RestorePackages">
    <Exec Command="&quot;$(MSBuildProgramFiles32)\NuGet\NuGet.exe&quot; config -set http_proxy=http://********" />
    <Exec Command="&quot;$(MSBuildProgramFiles32)\NuGet\NuGet.exe&quot; config -set http_proxy.user=******" />
    <Exec Command="&quot;$(MSBuildProgramFiles32)\NuGet\NuGet.exe&quot; config -set http_proxy.password=********" />
    <Exec Command="&quot;$(MSBuildProgramFiles32)\NuGet\NuGet.exe&quot; restore &quot;$(SourceHome)*.sln&quot;" />
  </Target>

  <Target Name="Clean">
    <MSBuild Targets="Clean"
             Projects="@(Solution)" />
  </Target>

  <Target Name="Build" DependsOnTargets="RestorePackages">
    <MSBuild Targets="Build"
             Projects="@(Solution)" />
  </Target>

  <Target Name="Rebuild" DependsOnTargets="RestorePackages">
    <MSBuild Targets="Rebuild"
             Projects="@(Solution)" />
  </Target>

</Project>

但不知怎的,构建一次又一次地失败。这是错误:

Exception Message: Access to the path '******************\packages\AjaxControlToolkit.15.1.4.0\Content\Web.config.transform' is denied. (type UnauthorizedAccessException).

我不知道发生了什么,有什么想法吗?

2 个答案:

答案 0 :(得分:0)

您可以检查文件是否为只读。

答案 1 :(得分:0)

最后,问题是用于构建服务的NETWORK SERVICE帐户。该帐户似乎没有足够的权限来使用代理。将其更改为我的帐户终于工作了。我知道这不是理想的方法,但现在就是诀窍。