none
XCopy Error RRS feed

  • Question

  • I'm not sure why I'm getting this error. I'm trying to import an existing project to compile it to a web app. 

    Severity Code Description Project File Line Suppression State
    Error The command "xcopy C:\Users\mholmes\Downloads\AHa Form\AHAForm\bin\AHAForm.* C:\Users\mholmes\Source\repos\AHAForm\..\..\iweb\bin\ /y
    xcopy C:\Users\mholmes\Downloads\AHa Form\AHAForm\bin\AHAForm.* C:\Users\mholmes\Source\repos\AHAForm\..\..\eweb\bin\ /y
    xcopy C:\Users\mholmes\Downloads\AHa Form\AHAForm\bin\AHAForm.* C:\Users\mholmes\Source\repos\AHAForm\..\..\xweb\bin\ /y" exited with code 4. AHAForm

    Does anyone know what this error code means?

    Tuesday, March 12, 2019 4:14 PM

All replies

  • If you did not yet find and adjust this command in “Build Events” tab of Project Properties, then maybe try moving the solution to a folder that does not contain spaces. (Or rename the “AHa Form” folder). Then reopen the solution in Visual Studio using its new location.

    Tuesday, March 12, 2019 6:07 PM
  • Generally that means the path is wrong, the file(s) don't exist or there was an error copying over the files. I would recommend that you take the command being run (from a post-build event I assume) and try running it from the project directory to verify the information is correct. It has hard coded paths there but I assume it is likely using a macro (e.g. $(SolutionDir)) so you'll need to verify the paths are valid. Generally when you use xcopy to overwrite files you need to pass some extra parameters. /y is a start but you probably also need /R.

    Michael Taylor http://www.michaeltaylorp3.net

    Tuesday, March 12, 2019 6:07 PM
    Moderator
  • Is that the literal text of the command?  You do have a syntax error there because of the space in the folder name.  xcopy is going to see these parameters:

    • C:\Users\mholmes\Downloads\AHa
    • Form\AHAForm\bin\AHAForm.*
    • C:\Users\mholmes\Source\repos\AHAForm\..\..\iweb\bin\
    • /y

    You may need to embed double quote marks in your build step, as in

    xcopy \"C:\Users\mholmes\Downloads\AHa Form\AHAForm\bin\AHAForm.*\" ...


    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Tuesday, March 12, 2019 9:16 PM
  • Hi

    Thank you for posting here.

    According to your description, you want to solve Xcopy error.

    The following link is similar to your problem, so it will be helpful for you to solve it.

    https://stackoverflow.com/questions/5626557/what-is-going-wrong-when-visual-studio-tells-me-xcopy-exited-with-code-4

    Best regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, March 13, 2019 5:53 AM
    Moderator
  • Hi

    Is your problem solved? If so, please post "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Friday, March 15, 2019 5:12 AM
    Moderator