Fix .NET Aspire Azure Container Apps Missing Bicep File Deployment Error
Question details
The user needs to resolve an Azure pipeline deployment failure where a .NET Aspire application cannot provision due to a missing main.bicep file.

- Product
- .NET Aspire and Azure Container Apps
- Device & OS
- not provided
- Scenario
- Deploying a .NET Aspire application with custom domain configurations via Azure Pipelines.
- Observed behavior
- The pipeline fails during the provisioning stage with an error stating that Bicep cannot find the /home/vsts/work/1/s/infra/main.bicep file.
Ensure you have access to your Azure DevOps pipeline deployment logs and your source code repository to verify file paths and deployment configurations.
Verify Repository Structure and Pipeline Configuration
Ensure the required main.bicep file is actually committed to the repository and the pipeline working directory is correctly mapped.
Azure pipelines often fail to find Bicep files if the infrastructure folder is missing from the branch triggering the deployment, or if the pipeline's working directory context is slightly off.
Navigate to your Git repository in Azure DevOps or GitHub and verify that the infra/main.bicep file is committed and pushed to the deployment branch.
Open your pipeline YAML configuration file and check the workingDirectory parameter for the Bicep deployment task to ensure it correctly points to $(System.DefaultWorkingDirectory)/infra or the appropriate relative path.
Download the raw pipeline deployment logs and inspect the source checkout step to confirm that the infra folder is being successfully downloaded into /home/vsts/work/1/s/.

Seek Specialized Assistance on Microsoft Learn
Since this involves complex .NET Aspire orchestration and Azure DevOps infrastructure configurations, escalating to official Microsoft support forums is recommended.
Need a Lightweight Office Suite for Your Developer Documentation?
While troubleshooting Azure DevOps and .NET Aspire deployments requires specialized Microsoft tools, managing your project documentation shouldn't be a hassle. WPS Office is a highly compatible, free alternative to Microsoft Office, perfect for writing technical specifications, analyzing exported CSV deployment logs, and collaborating on DevOps architectures.
- 1. Download the Software: Visit the official WPS Office website and download the free installer for Windows, Mac, or Linux.
- 2. Manage Technical Specs: Use WPS Writer to draft and edit your Azure architecture documentation with full Microsoft Word compatibility.
- 3. Analyze Pipeline Logs: Open exported Azure pipeline CSV logs in WPS Spreadsheet to filter and diagnose deployment errors efficiently.

Frequently Asked Questions
Why does the Azure pipeline say main.bicep cannot be found?
This usually happens if the file was not committed to the source repository, the pipeline checkout step is configured incorrectly, or the working directory path in the deployment YAML task does not accurately match the cloned repository structure.
Where should the infra/main.bicep file be located in a .NET Aspire project?
In a typical .NET Aspire project, the Bicep files generated for Azure deployment are located in the infrastructure or .azure directories, depending on how azd (Azure Developer CLI) or your custom deployment scripts are configured.
How do I verify the working directory structure in Azure DevOps pipelines?
You can verify the pipeline's working directory by adding a temporary Bash or PowerShell script task with the command 'ls -la $(System.DefaultWorkingDirectory)' or 'tree' before your deployment task to output the actual file structure into the pipeline logs.




