Self hosted agent publish failing with access is denied error while running pipeline for Web API project

191 Views Asked by At

I am trying to publish Web API project using Azure DevOps pipeline with Self hosted agent. It is building properly but failing in publish step with following error:

##[error]One or more errors occurred. (One or more errors occurred. (Access to the path 'f:\agent\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.181.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll' is denied.)) (Access to the path 'f:\agent\_work\_tasks\DotNetCoreCLI_5541a522-603c-47ad-91fc-a4b1d163081b\2.181.0\dotnet-build-helpers\Microsoft.TeamFoundation.DistributedTask.MSBuild.Logger.dll' is denied.) 

Strangely, when I remove class project references (Infra & application layer) from Web API project then publish is working fine.

I even tried removing _work folder but no use.

We are using on-premises version of AzureDevOps

Expecting publish to complete successfully.

1

There are 1 best solutions below

0
T Ahmad On

Facing a similar issue. My pipeline had some Dotnet CLI and SonarQube tasks, but even after removing those, we still see an issue.

One workaround is to use dotnet build with argument nodeReuse:false. Not sure if it's a fluke that builds have started succeeding.

If you have any Sonar steps, those might be the cause of the issue.