Self-Hosted build agent-CS2012:无法打开.dll进行写入,访问被拒绝

问题描述 投票:0回答:1

我的自托管构建代理昨天开始在dotnet构建期间报告错误。完整命令:

C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src>"C:\Program Files\dotnet\dotnet.exe" build C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\Cloud.Core.Extensions.Nest.csproj "-dl:CentralLogger,\"C:\agent\vsts-agent-win-x64-2.166.4\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.168.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"*ForwardingLogger,\"C:\agent\vsts-agent-win-x64-2.166.4\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.168.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll\"" --configuration release

预期构建正常。实际输出:

Microsoft (R) Build Engine version 16.6.0-preview-20126-02+13cfe7fc5 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Determining projects to restore...
  All projects are up-to-date for restore.
  You are using a preview version of .NET Core. See: https://aka.ms/dotnet-core-preview
##vso[task.logdetail id=8d38fe20-6aaa-4bc0-a56a-6659df9b8b93;parentid=;name=CSC;type=Build;starttime=2020-05-08T16:07:55.6837318Z;state=InProgress;]
##vso[task.logissue type=Error;sourcepath=CSC;linenumber=0;columnnumber=0;code=CS2012;]Cannot open 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' for writing -- 'Access to the path 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' is denied.'
##vso[task.logdetail id=8d38fe20-6aaa-4bc0-a56a-6659df9b8b93;parentid=;type=Build;result=Failed;finishtime=2020-05-08T16:07:55.6892238Z;progress=100;state=Completed;parentid=;name=;]
CSC : error CS2012: Cannot open 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' for writing -- 'Access to the path 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' is denied.' [C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\Cloud.Core.Extensions.Nest.csproj]

Build FAILED.

CSC : error CS2012: Cannot open 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' for writing -- 'Access to the path 'C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\obj\release\netstandard2.1\Cloud.Core.Extensions.Nest.dll' is denied.' [C:\agent\vsts-agent-win-x64-2.166.4\_work\19\s\src\Cloud.Core.Extensions.Nest\Cloud.Core.Extensions.Nest.csproj]
    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.83

csproj的项目文件定义为:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netstandard2.1</TargetFramework>
    <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
    <Company></Company>
    <Version>3.1</Version>
    <PackageIconUrl></PackageIconUrl>
    <Copyright></Copyright>
    <Description>A set of extension methods for the Elasticsearch Nest client</Description>
    <PackageTags>Nest Elasticsearch Extension Cloud.Core .net-Core Core aspnetcore</PackageTags>
    <SignAssembly>false</SignAssembly>
    <ProjectGuid>{9BCDBAA0-141F-404B-864B-74A35A476AAD}</ProjectGuid>
    <RepositoryUrl></RepositoryUrl>
    <RepositoryType>Private</RepositoryType>
    <Authors></Authors>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.CSharp" Version="4.7.0" />
    <PackageReference Include="NEST" Version="6.3.1" />
    <PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
    <PackageReference Include="Polly" Version="7.2.0" />
  </ItemGroup>
</Project>

任何想法为何?我为代理使用的读取/写入文件夹添加了额外的权限,这很不高兴。我也从网络服务更改为特权更高的帐户,但仍然遇到问题。多次重启机器。

这一直进行到昨天。还有其他人面对过这个特殊问题吗?

感谢任何提前的指针。

.net .net-core azure-devops msbuild
1个回答
1
投票

作为一种解决方法,您可以删除_work文件夹并重建以生成新的_work文件夹。

© www.soinside.com 2019 - 2024. All rights reserved.