Skip to content

[BUG]: Access to the path '*.csproj.nuget.g.props' is denied.Β #5495

@LoriBru

Description

@LoriBru

What happened?

Hello, I am currently running an Agent on my local VM, the version is 4.268.0.
I am struggling to get the unit test pipeline working for my .NET solution.
The pipeline currenly looks like this (but I tried already many attempts):

trigger: none

pool:
  name: Vs2026

variables:
  solution: '**/*.slnx'
  buildPlatform: 'x64'
  buildConfiguration: 'Release'

steps:
- task: DotNetCoreCLI@2
  displayName: Build solution
  inputs:
    command: 'build'
    projects: '$(solution)'
    arguments: '--configuration $(BuildConfiguration) /p:Platform=$(BuildPlatform)'
- task: DotNetCoreCLI@2
  displayName: 'Run unit tests'
  inputs:
    command: 'test'
    projects: '**/tests/*/*.csproj'

I get the following error when I try to run it:

"C:\Program Files\dotnet\dotnet.exe" test C:\agents\VS2026\_work\3\s\tests\Testing.Core.Authentication\Testing.Core.Authentication.csproj --logger trx --results-directory C:\agents\VS2026\_work\_temp
Specifying a project for 'dotnet test' should be via '--project'.
##[error]Error: The process 'C:\Program Files\dotnet\dotnet.exe' failed with exit code 1
"C:\Program Files\dotnet\dotnet.exe" test C:\agents\VS2026\_work\3\s\tests\Testing.Core.Data\Testing.Core.Data.csproj --logger trx --results-directory C:\agents\VS2026\_work\_temp
Specifying a project for 'dotnet test' should be via '--project'.
...

And so on for all my unit tests projects.

If I remote login into my VM, I execute dotnet test and I get the following error:

PS C:\agents\VS2026\_work\3\s\tests\Testing.Core.Authentication> dotnet run --project=Testing.Core.Authentication.csproj
C:\Program Files\dotnet\sdk\10.0.103\NuGet.targets(196,5): error Access to the path 'C:\agents\VS2026\_work\3\s\src\Core.Contracts\obj\Core.Contracts.csproj.nuget.g.props' is denied.
The build failed. Fix the build errors and run again.

But then if I run my cmd as Administrator it works just fine.
Can you help me with this issue? Thanks.

Versions

Azure DevOps agent version 4.268.0, Windows Server 2025 Standard version 10.0.26100 Build 26100.

Environment type (Please select at least one enviroment where you face this issue)

  • Self-Hosted
  • Microsoft Hosted
  • VMSS Pool
  • Container

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Azure DevOps Server Version (if applicable)

Azure DevOps Server 2022.2

Operation system

Windows Server 2025

Version controll system

No response

Relevant log output

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions