What is going wrong when Visual Studio tells me “xcopy exited with code 4”

后端 未结 16 2109
北荒
北荒 2020-12-05 01:33

I\'m not very familiar with post-build events, so I\'m a little confused as to what\'s going wrong with my program. When compiling in visual studio 2010, I get the following

16条回答
  •  半阙折子戏
    2020-12-05 02:09

    I received the 'exited with code 4' error when the xcopy command tried to overwrite a readonly file. I managed to solve this problem by adding /R to the xcopy command. The /R indicates read only files should be overwritten

    old command:

    XCOPY /E /Y "$(ProjectDir)source file" "destination"
    

    new command

    XCOPY /E /Y /R "$(ProjectDir)source file" "destination"
    

提交回复
热议问题