Questions tagged [pre-build-event]

An event to run scripts, macros or other actions before 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 before compilation. These actions (if specified) are executed just before compilation.

How to specify build event - MSDN

190 questions
87
votes
8 answers

Solution-wide pre-build event?

I have a solution in Visual Studio which contains several projects. I'd like to run a command at the very beginning of every build - no matter which projects are involved and whether or not they are up-to-date. Essentially I need something similar…
user200783
  • 13,722
  • 12
  • 69
  • 135
64
votes
7 answers

How to delete files in Visual Studio Pre-build event command line

I am trying to delete files in my $(TargetDir) within visual studio before building a project. How do you have to format command line to get around this problem I am getting below?
dance2die
  • 35,807
  • 39
  • 131
  • 194
35
votes
6 answers

Swallowing errors in pre-build steps in Visual Studio 2010

My solution has a bunch of projects one of which is a windows service; I have a prebuild step to stop the service and a postbuild step to restart it (this way the windows service exe is not locked when VS is building/overwriting it). on pre-build:…
Andrey
  • 20,487
  • 26
  • 108
  • 176
34
votes
5 answers

Visual Studio add pre-build event that always runs (C# project)

In my project, I am running an external tool to update some binary files. These files are included in the project as "content". At the moment the tool is set to run during "pre-build event" in C# project properties. Unfortunately, this event is only…
kaalus
  • 4,475
  • 3
  • 29
  • 39
29
votes
5 answers

Prebuild event Copy command exits with code 1

I have the following in a prebuild event: copy /y $(ProjectDir)ThirdPartyAssemblies\ $(TargetDir) Which results in the following error: The command "copy /y C:\Users\myusername\Documents\Visual Studio…
Mark Bostleman
  • 2,185
  • 3
  • 25
  • 32
19
votes
2 answers

Create pre build event to copy files to assets folder in Android application

I have this project structure: ProjectFolder/IosFolder,AndroidFolder,CommonFolder Now android app uses files from it's assets folder. But we decide to make Common folder for the same files. Could you help me to make function witch will copy files…
vlasentiy
  • 342
  • 1
  • 6
  • 12
18
votes
4 answers

Event Build pre & post to stop and restart Windows service

I've been experimenting with using build events to start and stop Windows service that are being built in my project. However for the pre & post builds fail with an error level 255. I've tried catching this with the pre-build with no…
wonea
  • 4,783
  • 17
  • 86
  • 139
14
votes
5 answers

Delphi pre-build event not executing BEFORE compile

I'm busy automating our builds to include the svn revision number. We're using Delphi 2010. I added a pre-build event calling a batch file that injects the the svn revision number (read from the entries file in the .svn directory) and a specified…
Jaco Briers
  • 1,703
  • 1
  • 21
  • 34
14
votes
4 answers

Build another project by prebuild event without adding reference

I am copying .exe file form a separate to my main project's folder on prebuild event but I need to build that project before build my main project so i want to build that project on prebuild event of my main project.
Govind Malviya
  • 13,627
  • 17
  • 68
  • 94
13
votes
5 answers

Run batch script before Debugging

I want to run a batch script every time before starting program for debugging. For the build events, such functionality is realized using pre-build event, post-build event. For actual debugging, I could not find any pre-Debug, post-Debug events. How…
Tilak
  • 30,108
  • 19
  • 83
  • 131
13
votes
1 answer

Is there a way to add pre-build step for Jenkins pipeline?

Currently I'm able to use a post directive in my Jenkinsfile. Is there a way to trigger a pre-build step similar to this ? post { always { sh '''rm -rf build/workspace''' } }
mirza
  • 5,685
  • 10
  • 43
  • 73
11
votes
1 answer

How to use ~/.bash_profile environment variables when using "Run Script" in "Build Phases" for XCode 6.1?

I have a cross platform unit testing framework that I use for C++. In order to build and run the tests in XCode 6.1 I need to run a python script as part of a prebuild script. Since I use the same unit testing framework for multiple projects I…
David
  • 871
  • 11
  • 24
11
votes
4 answers

Pre and Post Build event parameters

In Visual Studio, can someone point me to a list of available pre- and post-build events parameters? eg. $(TargetDir), etc.
user1428521
10
votes
2 answers

Visual Studio Pre-build Event/Post-build Events Working Directory

It's not clear from the documentation what the working directory is for pre-build or post-build events in Visual Studio. What is it? Where is this documented?
8
votes
0 answers

npm hangs when called in Visual Studio prebuild events

Why when running the commands below in the cmd (and the current directory being the root of my visual studio project), everything is okay : npm install webpack --config webpack.config.vendor.js webpack But when asking to run that in my ASP.NET Core…
Natalie Perret
  • 8,013
  • 12
  • 66
  • 129
1
2 3
12 13