Post Build Exited Event ID 1

I am trying to clear the release folder using the Post Build event so that I delete the .xml and .pdb .xml and try to copy all the dll files to the folder with the lib folder error. I get Post Build Exited with Code 1

My code is:

 if $(ConfigurationName) == Release del "$(TargetDir)*.xml", "$(TargetDir)*.pdb" if $(ConfigurationName) == Release xcopy "$(TargetDir)\*.dll" "$(TargetDir)\lib\" 

The 2 commands are separated by a new line, as shown ... There is also a Lib folder.

+6
source share
5 answers

Instead

 xcopy $(TargetDir)*.dll $(TargetDir)lib\ 

you should use

 xcopy "$(TargetDir)*.dll" "$(TargetDir)lib\" 

to handle spaces along the way.

+6
source

Try opening VS using Run as Administrator -> open project -> build.

+3
source

First try using $(TargetDir)\ , as there are some variables that return without a trailing slash that will concatenate your path so you look for bin\Debuglib\ instead of bin\Debug\lib

As pointed out by @Uwe Keim, Return Code 1 means that no files were found for copying . This can also happen if you pointed to an invalid folder, which confirms the idea that you might need \ .

There is also the possibility that the del command failed, although the same delta article does not indicate any return codes. Some forum sources indicate that a return code of 1 may indicate a failed deletion.

0
source

This modification worked for me:

 del *.XML, *.pdb xcopy /y "$(TargetDir)*.dll" "$(TargetDir)lib\" 

1). Omit directory target variable in del command

2) ./ y in xcopy Note from the Microsoft help page: / y: Suppresses the confirmation message that you want to overwrite the existing destination file.

0
source

This solution worked for me

 xcopy "$(TargetDir)*.dll" "$(TargetDir)lib\" 
0
source

Source: https://habr.com/ru/post/972729/


All Articles