Post Build exited with code 1

后端 未结 18 1852
囚心锁ツ
囚心锁ツ 2020-12-04 16:11

I have a project with a post build event:

copy $(ProjectDir)DbVerse\\Lunaverse.DbVerse.*.exe  $(TargetDir)

It works fine every time on my m

相关标签:
18条回答
  • 2020-12-04 16:40

    I just received the same error. I had a % in the destination path that needed to be escaped

    c:\projects\%NotAnEnvironmentVariable%
    

    needed to be

    c:\projects\%%NotAnEnvironmentVariable%%
    
    0 讨论(0)
  • 2020-12-04 16:43

    I had to run VS as Administrator to get my post-build copy to an OS protected "..\Common7\IDE\PrivateAssemblies" to work

    0 讨论(0)
  • 2020-12-04 16:44

    The one with the "Pings" helped me... but may be explained a little better...

    For me the solution was to change:

    copy $(TargetDir)$(TargetName).* $(SolutionDir)bin
    

    to this:

    copy "$(TargetDir)$(TargetName).*" "$(SolutionDir)bin"
    

    Hope it works for you. :-)

    0 讨论(0)
  • 2020-12-04 16:44

    So many solutions...

    In my case, I had to save the bat file with non-unicode (Western, Windows) encoding. By default when I added the file to visual studio (and probably I should have done it outside of the VS), it added with UTF-8 encoding.

    0 讨论(0)
  • 2020-12-04 16:45

    As a matter of good practice I suggest you replace the post build event with a MS Build File Copy task.

    0 讨论(0)
  • 2020-12-04 16:49

    My reason for the Code 1 was that the target folder was read only. Hope this helps someone! I had a post build event to do a copy from one directory to another and the destination was read only. So I just went and unchecked the read-only attribute on the directory and all its subdirectories! Just make sure that its a directory that's safe to do so!

    0 讨论(0)
提交回复
热议问题