PostBuild events are not run on AppHarbor? - build

I've got a postbuild event that is executed just fine locally, but not on AppHarbor:
<PostBuildEvent>
if not exist "$(TargetDir)NativeBinaries" md "$(TargetDir)NativeBinaries"
xcopy /s /y /i "$(SolutionDir)packages\LibGit2Sharp.0.8\NativeBinaries\x86\*.*" "$(TargetDir)NativeBinaries\x86"
xcopy /s /y /i"$(SolutionDir)packages\LibGit2Sharp.0.8\NativeBinaries\amd64\*.*" "$(TargetDir)NativeBinaries\amd64"
</PostBuildEvent>
What am I doing wrong?

Postbuild events are executed as part of the AppHarbor build process. For particulars on why your build may be failing, please see the related AppHarbor support discussion.

Related

Makefile Windows -- remove directory if exists

I am trying to port a Makefile to Windows (using GNU Make). I am having trouble with removing directories. I found this question (Delete a directory and its files using command line but don't throw error if it doesn't exist) on how to conditionally remove directories, but I get an error trying to use that solution, translating approximately to The use of ""doc\html"" is syntactically impermissible in this context
The snippet causing it is this:
if exists "doc\html\" rmdir /Q /S doc\html
I also tried
cmd /c if exists "doc\html" cmd /c rmdir /Q /S doc\html
and
cmd /c if exists "doc\html\" cmd /c rmdir /Q /S doc\html.
I also tried rmdir /Q /S doc\html 2>nul. That works kind of. The error gets redirected, but Make still throws an error and stops.
How can I make this work?
the command is exist not exists. There is a typo in the thread I linked...

Postbuild Event Copy build output to parent sibling undertermined folder

I have two solutions, WildCougarFarm and WildLionFarm both depending on a shared library
\Folder 1
\WildCougarFarm
\WildSharedLib (Separate Solution)
\Folder 2
\WildLionFarm
\WildSharedLib (Separate Solution)
When \WildSharedLib is built I want to run a post build script that automatically copies the output directories contents to the sibling \Wild[Lion|Cougar]Farm solution folder. Depending on whether WildLionFarm exists, I want it to copy with say wildHorseFarm in future.
I need an xcopy expression with a regex but xcopy doesn't support this.
Any ideas how I can accomplish this?
I figured it out.
This is pretty cool, because it uses a foreach type loop... so we ask if the parent folder of the solution contains any folders that end in farm. For any returned it will execute the xcopy statement to copy the files to that folder.
for /d %%a in ($(SolutionDir)..\*farm) do xcopy $(TargetDir)*.* "%%a\dependancies" /s /e /f /h /k /y /i

TFS - xcopy not working with my TFS builds

I created a custom template for a TFS build that copies files from a Source folder to a Destination folder.
ForEach<String>
InvokeProcess
xcopy "C:SourceFolder\File1.doc" "C:DestinationFolder"
ForEach<String>
InvokeProcess
xcopy "C:SourceFolder\File2.doc" "C:DestinationFolder"
I can type the xcopy line into a command prompt and it works just fine, but for some reason not in TFS. I get no error. I have been stuck on this for a few days and now I'm just baffled. Anyone have any experience with this?
You have to fully qualify the path to xcopy. So the filename for invoke process should be "C:\Windows\System32\xcopy.exe"

Post-Build script throws error in VIsual Studio 2010

I've seen several threads with the same issue, but none of the solutions seems to work for me so I'm trying it here.
I need a post-build script in VS2010 that moves a .lib file to a directroy (which possibly dosn't exist yet; if so create it).
I am using this, which returns error code 2:
xcopy /y "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)lib\$(ProjectName).lib"
Also tried, which returns error code 1: (what is the difference?)
copy /y "$(TargetDir)$(ProjectName).lib" "$(SolutionDir)lib\$(ProjectName).lib"
The most common issues people seem to hav is the lack of quotes on paths, but I have that.
Why dosn't it work?
This ought to be closer:
if not exist "$(SolutionDir)lib" md "$(SolutionDir)lib"
xcopy /y /d "$(TargetPath)" "$(SolutionDir)lib"
After a quick test on the command line what's happening with copy is it is failing because the directory does not exist. What is happening with xcopy is it is failing when it prompts for whether the target is a file or directory when it finds the directory doesn't exist. /-Y may be set in your COPYCMD environment variable or your target path may be misleading causing a prompt for whether the target is a directory or file which is not supressed by the /Y flag for overwrite.
Example: xcopy /Y "C:\test.txt" "missingdirectory\test5.txt"
Obviously the easiest solution is to check if the directory exists and create it if it's missing before doing the copy in your post-build script.

Copy Directory - Post Build Event

How do I copy some directory from one place to another (not file by file)
in post build event (whats the comman line??). im using vs 2005 (c++ project)
For more clarification, here is an example that copies a folder called "ApplicationFiles" from the root of your project to the destination (binary) folder:
xcopy "$(ProjectDir)ApplicationFiles" "$(TargetDir)ApplicationFiles" /e /y /i /r
Thanks, just what I needed. Options documented here for future reference:
/E Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T.
/Y Suppresses prompting to confirm you want to overwrite an existing destination file.
/I If destination does not exist and copying more than one file, assumes that destination must be a directory.
/R Overwrites read-only files.
The commandline is simply a batch script that is executed upon completion of the build. Therefore, you can just use regular Windows shell commands, such as mkdir, copy, ... To copy whole directories recursively, use xcopy <src> <dest> /E.