I am using Azure CI/CD Pipeline. The project is a ASP.NET app (Website project) which builds successfully. The Azure Pipeline Archive fails finding the dir D:/a/_temp/WebAppContent.
I dont know if the "Build Solution" before the "Archive Files" in the pipeline is causing the issue.
Where can I check to make sure the rootFolderOrFile is created before the "Archive Files"?
YAML
steps:
- task: VSBuild@1
displayName: 'Build solution **\*.sln'
inputs:
solution: '$(Parameters.solution)'
msbuildArgs: '/p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:publishUrl="$(Agent.TempDirectory)\WebAppContent\\"'
platform: '$(BuildPlatform)'
configuration: '$(BuildConfiguration)'
steps:
- task: ArchiveFiles@2
displayName: 'Archive Files'
inputs:
rootFolderOrFile: '$(Agent.TempDirectory)\WebAppContent'
includeRootFolder: false
ERROR
ls: no such file or directory: D:/a/_temp/WebAppContent
Found 0 files
##[error]Error: ENOENT: no such file or directory, stat 'D:\a\_temp\WebAppContent'
##[error]ENOENT: no such file or directory, stat 'D:\a\_temp\WebAppContent'
Finishing: Archive Files
Here is my Pipeline screeshot
I solved the issue finally. See the Pipeline I am using below.
Create a new VS Solution and a new Class Library Project
Git Commit to Azure > and Build (success)
In new solution > Add Existing Project > Website (this is legacy asp.net app with aspx and aspx.cs pages)
In Website, you must add website.publishproj
Build locally and Run locally (success)
Git Commit again to Azure > some DLL missing
Added missing DLL to project using include files
Git Commit again to Azure > now DLL are pushed to Git
Successful Build in Azure.
The the main issue was I need to create a brand new Solution + Project, then add Existing Website
Update: I had to delete the default Archive step and re-add from the Find menu
Update 2: Here is the YAML that is working
trigger:
- main
pool:
vmImage: 'windows-latest'
variables:
solution: '**/*.sln'
buildPlatform: 'Any CPU'
buildConfiguration: 'Release'
steps:
- task: NuGetToolInstaller@1
displayName: NuGet - Installer
- task: NuGetCommand@2
displayName: NuGet - Restore
inputs:
restoreSolution: '$(solution)'
- task: VSBuild@1
displayName: VS Build Legacy App publishproj
inputs:
solution: '**\*.publishproj'
msbuildArgs: '/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=true /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.artifactStagingDirectory)"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
- task: AzureRmWebAppDeployment@4
displayName: Azure WebApp Publish
inputs:
ConnectionType: 'AzureRM'
azureSubscription: 'Azure WebApp'
appType: 'webApp'
WebAppName: 'XXXXXXXX'
packageForLinux: '$(build.artifactStagingDirectory)/**/*.zip'