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
12
votes
1 answer

Visual studio postbuild - changing to the solution drive

In Visual Studio postbuild, I need to run a batch file. The solution is potentially on a different drive to that which Visual Studio is running from. In postbuild, how do I determine the drive letter that the solution is running from so I can change…
Nathan Ridley
  • 33,766
  • 35
  • 123
  • 197
11
votes
3 answers

Specify VS macros in a batch file to run pre or post build

I can use the VS macros like $(ProjectDir) in my pre & post build events. But is there any way I can specify them in a batch file & run the batch file as my pre & post build event? e.g. Before Post-Build event copy $(ProjectDir)foo.txt…
Nikhil
  • 2,028
  • 7
  • 24
  • 33
11
votes
1 answer

Post-build event command for publish (Visual Studio 2010)

I have a project in visual studio 2010. This project has the following post-build event command lines: SET TARGET_PROJECT=TestMain IF NOT EXIST "$(TargetDir)IceBox" ( XCOPY /E /I /Y "$(SolutionDir)Externals\IceBox" "$(TargetDir)IceBox" ) IF NOT…
Waronius
  • 363
  • 2
  • 4
  • 10
11
votes
2 answers

How to use an OR statement in a Post-Build event?

I am trying to use a conditional with an OR in a Post-Build event, but so far, I have had not luck. The following does not work: if not "$(ConfigurationName)" == "Debug" or not "$(ConfigurationName)" == "Release" ( but this works: if not…
Xaisoft
  • 45,655
  • 87
  • 279
  • 432
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?
10
votes
7 answers

Build same Project as Console and DLL

I've got an C# Project in Visual Studio, which has Console Application as Output Type. But I also need a Class Library of this project for another solution. Right now I have to switch the output type every time, but I wonder if it's possible to…
10
votes
2 answers

What is the difference between a Custom Build Step and a Post-Build Event?

Both project settings allow me to execute custom commands. What are the benefits or drawbacks of each?
10
votes
3 answers

ILMerge.Merge: ERROR!!: Duplicate type found in assembly

I'll make this as simple as I can, if you need any more info please let me know. I downloaded ILMerge to merge Newtonsoft.Json.dll into my class library. I am invoking ILMerge from the post-build event command line with the…
Dean
  • 4,554
  • 7
  • 34
  • 45
10
votes
1 answer

How to use user-defined variable inside post-build event?

I want to use local variable inside the PostBuild event, but I could not understand how to use it inside. Here my Post-Build event commands (param is the named parameter that can be passed through the msbuild /p switch): set fold=$(TargetDir) if…
stukselbax
  • 5,855
  • 3
  • 32
  • 54
10
votes
1 answer

Visual Studio 2012: How to perform a conditional post-build event

How do I perform a conditional post-build event? Specifically, I would like to only execute the post-build event command line for the debug release but not for the release build. I did not see any way in a project's properties' Build Event page.
9
votes
6 answers

Adding a post-build event to a web site in Visual Studio 2008

I am using a "web site" in visual studio 2008, and i would like to add a post-build event which would append the build time to the web.config file. Is it possible?
PBG
  • 8,944
  • 7
  • 34
  • 48
9
votes
4 answers

Visual studio 2010 - Per Developer/machine/environment Web.Config settings

Wanted to pick the brains of those MS Build/ VS Post build exponents here. I would like to have my web.config entries customizable per user/machine/environment. I could have my configurable/changeable entries marked in the web.config and would like…
thanikkal
  • 3,326
  • 3
  • 27
  • 45
9
votes
4 answers

How do I use signtool in post build event for Visual Studio 2013 without hard coding path?

I've created a post build event to do code signing of the application after a successful build with the following post build script. copy $(TargetPath) $(TargetDir)SignedApp.exe signtool sign /t http://timestamp.verisign.com/scripts/timestamp.dll /a…
JonN
  • 2,498
  • 5
  • 33
  • 49
9
votes
2 answers

Visual Studio 2017 macros show empty on build but not in macro selector

When I add a post build event to my project and try to use a macro in the Edit Post-Build ... section it shows the value of each macro However when the build runs the value show blank the following was generated using echo "The project path is:"…
Vinez
  • 560
  • 2
  • 11
1 2
3
34 35