MSB3073: exited with code 4 RRS feed

  • السؤال

  • What is this ?

    I use this command in post-build event:

    xcopy $(SolutionDir)src\SomeSolutionFolder\SomeSubFolder\SomeProject\bin\$(ConfigurationName)\*.* $(SolutionDir)bin\$(ConfigurationName)\SomeSolutionFolder\ /C /F /D /Y /S

    And receive the error:

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: The command " xcopy C:\SolutionDir\src\SomeSolutionFolder\SomeSubFolder\SomeProject\bin\Release\*.* C:\SolutionDir\bin\Release\SomeSolutionFolder\ /C /F /D /Y /S

    C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets(3089,13): error MSB3073: " exited with code 4.


    And where I can find information about MSB3073 and error codes ?


    Thank you in advance.

    20/رجب/1428 08:32 ص


جميع الردود

  • MSB3073 is just a generic error that means an Exec task returned a non-zero error code. 


    I suspect the problem is that you need double quotes around your paths:


    xcopy "$(SolutionDir)src\SomeSolutionFolder\SomSubFolder\SomProject\bin\$(ConfigurationName)\*.*" "$(SolutionDir)bin\$(ConfigurationName)\SomeSolutionFolder\" /C /F /D /Y /S


    xcopy exit codes can be found here: http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/xcopy.mspx?mfr=true.




    20/رجب/1428 02:51 م
  • This may happen when you have a space in the path.

    xcopy $(SourcePath) $(TargetPath)  

    Wrap both source and target paths with double quotations (").
    xcopy "$(SourcePath)" "$(TargetPath)"  

    If you are using any bat file, update the file instead.

    Hope this would help.


    ...on the deadline, project should be buried where it belongs...
    • تم التحرير بواسطة D.C 03/ذو الحجة/1429 11:19 ص Correction
    03/ذو الحجة/1429 10:59 ص
  • running TFS 2008 .proj file with XCOPY  for the deployment to the app server.  I am getting an MSB3073 with and exit error code of 4.


    The same project script works just fine going to the previous APP server.  So I know the script works.  The only change I made was the deployment location.  I can log into the build server and run the script from the DOS prompt successfully.  The problem has got to be in the security and permissions on the new deployment server, but I can't find it.  What are the requirements?
    04/صفر/1430 06:40 ص
    • I have the same damned problem :(
    • Does anybody intend to help us?? :)
    21/ربيع الأول/1430 12:20 م
  • Alexandis, by same problem do you mean that you are trying to do an xcopy and are getting an rcode of 4?  If so, did you make sure that your paths have quotes around them? Any space in the path name will cause the copy to fail and return rcode 4. This can also be caused by a permission denied on the target location. Check to make sure that the login that the build is running under (normally a service login like NT SERVICE) has full permission on the target dir.
    mjlarezzo | Measure twice, cut once. Hee Hee. Hey, quit poking me!
    21/ربيع الأول/1430 05:48 م
  • If the line in the original post was pasted from his script, then you can see there are no spaces in this URL.

    In my original post the problem was a typo in the URL in the actual target drive directory names.  An extra space was introduced into the target directory name ( a double space between two words ).  This error was not reproduced in the Target URL in the build script.

    I found it by pasting the directory path and under that the URL from the script into a TXT doc for comparision.  At that point the extra space was easily visible.


    I got this error again today.  The message specifically stated the path was not good.  (though it does not state source or taget path)

    I immediately openned "My Computer" and pasted the offending URL from the script into the address box.  This demonstrates if the path is good or not.   The path worked. 

    I checked with the IT admins and found they had a connections issue in the network last night between 8pm and 8am.  Hence, at  the time of my nightly build, the URL was unreachable.  A rebuild this morning ran normally.


    Still would like to find a comprehensive list of the security and permissions requirements for all entities involved in the processes in TFS.
    22/ربيع الأول/1430 06:03 م
  • p.s. Problem is solved - i had to add 'Everyone' user to 'Full access' (i am making tfs build to another machine in LAN, but we trust each other, otherwise, as i understand, i should create the same account (that would be used for TFS build run) on all relevant LAN machines and Active Directory would take care of all)
    • تم الاقتراح كإجابة بواسطة DeSClark 19/شوال/1431 01:19 م
    11/جمادى الأولى/1430 09:31 ص
  • This worked for me....adding Everyone with full access security to the destination folder (in my case, I was using this as a post-build script in visual studio 2010 to a destination dir on the same machine)....thanks Alexandis!
    19/شوال/1431 01:18 م
  • if you dont like to add Everyone full access you can change the post build line from "xcopy [source] [dest]" to "start xcopy [source] [dest]". The start parameter explicitly starts a new window to perform the operation, thus cating it with your Administrator privileges
    • تم الاقتراح كإجابة بواسطة klaus4040 24/ربيع الأول/1432 01:43 م
    05/ربيع الأول/1432 11:17 ص
  • Thanks.  This was a far better approach.  I couldn't even get it to work with "Everyone".  The individual who had the machine before me did some pretty weird things to the folder permissions structures.
    09/ربيع الثاني/1432 11:51 م
  • Thanks a lot. Adding the quotes working for me. I am using xcopy in DNN Development to copy the module to the website. Just throwing it in there for future reference for others
    13/ربيع الثاني/1432 02:31 م
  • Thank you, it worked for me as well
    29/ربيع الثاني/1438 02:01 م