0
votes

We were trying to build a pipeline using MS Hosted agent with vmImage (vs2017-win2016) for a .net application, but build id is failing with following errors..Any ideas? Now, same source code successfully builds on On-premise build server & since we are now using Azure Devops to create build pipeline using MS Hosted agent, its failing.

This is the only build error we are getting right now. Any valuable comments or inputs highly appreciated.

Error details are as below:

Error analysis Build solution (VSBuild) - VSBuild Task

C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(5165,5): Error MSB3073: The command "copy "D:\a\1\s\Modules\HP.AMI.Modules.VirtualHeadEnd\ResponseTemplates*.xml" C:\AMI\Templates " exited with code 1.

1
Is that a post-build script you have configured?Matt
Hi Matt, I have not configured any post-build script. I am using classic editor to create build pipeline. I only used the default tasks & no post-build scripts were added.Rajat Wadhwa
I mean on your project files, do you have a post-build task. The C:\AMI\Templates kind of looks like a hard-coded value. I might guess there is some kind of file structure issue you are having when trying to write to a directory that might not exist or you might not have access to on the microsoft-hosted agent.Matt
You were spot on Matt. On the project files, i could see post-build event command line: copy "$(ProjectDir)ResponseTemplates*.xml" C:\AMI\Templates Please advise, how to get it fixed now in Azure Build PipelineRajat Wadhwa

1 Answers

1
votes

Build failing while creating Azure Build pipeline - Error MSB3073 - VSBuild Task

When you got the MSBuild error MSB3073, that means the path of the custom command line or custom target in your project is not correct. You need to check the path of that command line.

According the comment you replied, you have post-build event command line:

copy "$(ProjectDir)ResponseTemplates*.xml" C:\AMI\Templates

When you execute this command line without existing folder C:\AMI\Templates, the copy command will report an error of Error MSB3073. Because the target folder cannot be found.

To resolve this issue, we just need to add another post-build event command line to create the folder before the copy command line, like:

md C:\AMI\Templates
copy "$(ProjectDir)TextTemplate1.txt" "C:\AMI\Templates"

Now, we could build it with hosted agent vmImage (vs2017-win2016):

enter image description here