Questions tagged [post-build-event]

An event to run scripts, macros or other custom actions after compilation.

Build events can be used to run scripts, macros, or other custom actions as a part of the compilation process.

Post-build events occur after compilation. These actions (if specified) are executed just after compilation.

How to specify build event - MSDN

511 questions
265
votes
7 answers

Visual Studio Post Build Event - Copy to Relative Directory Location

On a successful build, I wish to copy the contents of the output directory to a different location under the same "base" folder. This parent folder is a relative part and can vary based on Source Control settings. I have listed a few of the Macro…
Preets
  • 6,792
  • 12
  • 37
  • 38
90
votes
10 answers

XCOPY switch to create specified directory if it doesn't exist?

I am using XCOPY in a post-build event to copy compiled DLLs from their output folders to the main app's output folder. The DLLs are being copied to a "Modules" subfolder in the main app output folder, like this: xcopy "$(TargetPath)"…
David Veeneman
  • 18,912
  • 32
  • 122
  • 187
51
votes
4 answers

Visual Studio: Run C++ project Post-Build Event even if project is up-to-date

In Visual Studio (2008) is it possible to force the Post-Build Event for a C++ project to run even if the project is up-to-date? Specifically, I have a project which builds a COM in-process server DLL. The project has a post-build step which runs…
user200783
  • 13,722
  • 12
  • 69
  • 135
48
votes
3 answers

Copy target file to another location in a post build step in CMake

I have a dynamic library that gets a different name depending on configuration, specified in the CMake scripts by: set_target_properties(${name} PROPERTIES OUTPUT_NAME ${outputName}64) set_target_properties(${name} PROPERTIES DEBUG_OUTPUT_NAME…
villintehaspam
  • 8,540
  • 6
  • 45
  • 76
42
votes
16 answers

How do I fix MSB3073 error in my post-build event?

I'm working on a project that requires that DLLs generated by building my solution to be copied from the bin folder to another folder, both of which are on my machine, in my C drive. I've written a batch file that uses xcopy to accomplish this,…
Sean Cogan
  • 2,516
  • 2
  • 27
  • 42
39
votes
3 answers

Can I copy multiple named files on the Windows command line using a single "copy" command?

I'd like to copy several known files to another directory as a part of a post-build event, but I don't want to have lines and lines of "copy [file] [destination] [switches]" in my build event. If possible, I'd like to list out the files I'd like to…
Mark Carpenter
  • 17,445
  • 22
  • 96
  • 149
34
votes
3 answers

PostBuildEvent Create Directory

I'm trying to create a folder named Design in the build output folder using th following commandline in the PostBuildEvent in visual studio mkdir $(TargetDir)Design ....Runs Successfully but folder is not created mkdir "$(TargetDir)Design" ....Runs…
Deepak
  • 731
  • 4
  • 11
  • 21
29
votes
3 answers

How to use xcopy to only copy files if they are newer?

I have many web applications in a Visual Studio solution. All have the same post build command: xcopy "$(TargetDir)*.dll" "D:\Project\bin" /i /d /y It would be useful to avoid replacing newer files with old ones (e.g. someone could accidentally add…
Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161
24
votes
3 answers

How to execute a PowerShell script only before a web deploy Publish task in VS 2012?

Currently I have a post-build event configured in my web project using Visual Studio 2012 like this: This basically calls a PowerShell script to add a copyright notice to every .cs file. What I'd like to do is to execute this powershell script only…
24
votes
3 answers

VS PostBuild Event - Copy file if it exists

Is there a simple way to copy a file in a post-build event for a Visual Studio project, but only if the file exists? (i.e. don't fail the build if the file doesn't exist) I've tried some options using xcopy. But I feel so stupid - I can't seem to…
Brad Leach
  • 16,857
  • 17
  • 72
  • 88
22
votes
6 answers

Are there any better ways to copy a native dll to the bin folder?

I have C# wrapper code that calls functions from a native (C++) dll. Currently, I can add a reference to the C# dll and have set the 'Copy Local' option to true. However the native dll, which is a dependency, cannot be added as a reference - so…
Ahmad
  • 22,657
  • 9
  • 52
  • 84
21
votes
1 answer

Delaying post-build Jenkins job

I have a Jenkins job which compiles and publishes our Java project to a JBoss server. Obviously, the server takes time to start and deploy the new code. I have a second Jenkins job that runs Selenium tests against the running JBoss instance. I…
Mike
  • 7,994
  • 5
  • 35
  • 44
21
votes
4 answers

VS2012 Post-build event not firing

I have a web project that fires a post-build event "On successful build" to perform some cleanup/migration activities (command script). In VS2012, post-build on success ONLY fires when there is a code change. If there is no code change, the…
Grant
  • 1,074
  • 1
  • 10
  • 7
20
votes
2 answers

VS2010: Can we have multiple if in post-build event?

Can we have something like this: if "Debug"=="$(ConfigurationName)" ( goto :nocopy ) else if "Release"=="$(ConfigurationName)" ( del "$(TargetPath).config" copy "$(ProjectDir)\App.Release.config" "$(TargetPath).config" ) else if…
tesicg
  • 3,971
  • 16
  • 62
  • 121
20
votes
3 answers

VS 2012: Post Build xcopy error 2

i want to make VS copy the .lib-file it created after the build process to a specific folder. So i went to the project config, post-build event, and entered the following command: if exist $(TargetPath) xcopy "$(TargetPath)"…
Juarrow
  • 2,232
  • 5
  • 42
  • 61
1
2 3
34 35