I am using TFS2012.I have created a build definition to build every checkIn uding VS2012. In Vs2008 for my project i have created a pre-build event with XCOPY to copy some files from solution Directory to another folder.But after i do CheckIn Build is failing with following error
Summary
Debug | Any CPU
1 error(s), 0 warning(s)
$/test/coding_files/cal_reg.sln - 1 error(s), 0 warning(s), View Log File
C:\Windows\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets (895): The command "XCOPY "C:\Builds\1\test\New Build Definition 1\Sources\coding_files\*.*" "\\pc97\D\" /E /Y /R /K" exited with code 4.
$/test/coding_files/cal_reg.sln compiled
No Test Results
No Code Coverage Results
Other Errors and Warnings
1 error(s), 0 warning(s)
Exception Message: MSBuild error 1 has ended this build. You can find more specific information about the cause of this error in above messages. (type BuildProcessTerminateException)
Exception Stack Trace: at System.Activities.Statements.Throw.Execute(CodeActivityContext context)
at System.Activities.CodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)
Why this is happening?what to do to execute copy command before build?
Please note that adding the /C switch to xcopy does not fix an error. It simply means that if xcopy encounters an error with one file and there are others to copy, it will not fail the whole copy process. It will just fail whatever can't be copied and continue on with other files that can be copied.
In some situations this may be desirable behavior but it could also be dangerous, hiding an actual copy problem depending on how you implement it.