CodexBloom - Programming Q&A Platform

Challenges in Setting Up a CI/CD Pipeline with Azure DevOps for .NET Core 6 Application

👀 Views: 491 💬 Answers: 1 📅 Created: 2025-09-07
azure-devops ci-cd .net-core C#

I've been researching this but I'm trying to implement Quick question that's been bugging me - Currently developing a .NET Core 6 application that needs to be integrated into a CI/CD pipeline using Azure DevOps... The build process works smoothly, but the deployment step fails with the error `Cannot access the path '$(System.DefaultWorkingDirectory)'`. I suspect this might be due to a misconfiguration in the YAML pipeline. Here's the relevant part of my YAML file: ```yaml trigger: branches: include: - main pool: vmImage: 'windows-latest' steps: - task: DotNetCoreCLI@2 inputs: command: 'restore' projects: '**/*.csproj' - task: DotNetCoreCLI@2 inputs: command: 'build' projects: '**/*.csproj' - task: DotNetCoreCLI@2 inputs: command: 'publish' publishWebProjects: true arguments: '--configuration Release --output $(System.DefaultWorkingDirectory)/publish' ``` Expecting the publish step to create a directory under `$(System.DefaultWorkingDirectory)` but it seems like it's not resolving correctly. I’ve tried using the literal path instead of the variable and it succeeds but I would prefer to keep it dynamic. Additionally, I ensured that the 'Allow Scripts to Access OAuth Token' option is enabled in the pipeline settings. Have also checked the agent job settings to confirm that there are no restrictions on the working directory. Is there something obvious I might be missing? Any insights on how to debug this further or adjustments to make in the YAML configuration would be appreciated. My development environment is macOS. Has anyone else encountered this? I'm working on a CLI tool that needs to handle this. Any ideas what could be causing this?