I am running an MSbuild task for my solution (with many projects) on Azure Devops but the build failed at some steps named _CopyFilesMarkedCopyLocal and (_CopyFilesMarkedCopyLocal target).
At these steps, the build attempted to create a 'bin/debug' folder before doing the copy but this failed with the error codes MSB3021, MSB3026 and MSB3027. Here's a part of my log file where this issue occurs.
##_CopyFilesMarkedCopyLocal:
Creating directory "bin\Debug".
Creating directory "bin\Debug".
Creating directory "bin\Debug".
Creating directory "bin\Debug
##[error]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\amd64\Microsoft.Common.CurrentVersion.targets(4384,5): Error MSB3027: Could not copy "d:\a\1\s\WWSS\packages\CrystalDecisions.Windows.Forms.1.0.0\lib\CrystalDecisions.Windows.Forms.dll" to "bin\Debug\CrystalDecisions.Windows.Forms.dll". Exceeded retry count of 10. Failed.
##[d:\a\1\s\my\project\path\M1.csproj]
The content of my yaml file is:
- task: NuGetCommand@2
inputs:
command: 'restore'
restoreSolution: '**/Mach1.sln'
feedsToUse: 'select'
vstsFeed: '93d16ac6-dhfjjj-43cb-89d5-e6a-41d0-b752-khf0e84jbf'
- task: MSBuild@1
inputs:
solution: '**/Mach1.sln'
msbuildArchitecture: 'x64'
platform: 'Any CPU'
configuration: 'Debug'
The solutions I found after searching for those error codes were only for scenarios where the files to be copied were locked, but not where the bin/debug folder already exists. From the build log, similar _CopyFilesMarkedCopyLocal steps on some projects in the solution ran successfully but I can't explain why it failed in other places.
I need a way to make the build continue even when the bin/debug folder already exists but I don't know where to make this setting.
Some of the links I've visited are listed below but none has been helpful