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
1
vote
1 answer

How to add commit hash to details of an executable file using GitVersion

In a previous question, I asked how to add a commit hash to an executable file, built in Visual Studio. I'm almost there: I have decided to use GitVersion and this tool indeed modifies the AssemblyInfo.cs files of my Visual Studio project, causing…
Dominique
  • 16,450
  • 15
  • 56
  • 112
1
vote
1 answer

ConfuserEx.exe in pre/ post build executing asynchronous in VS

I have an installer project that is generating .msi on build. In the pre-build event, I am calling Confuser.CLI.exe to obfuscate code, but exe is working asynchronous and taking too much time, and the compiler is finished before exe, so I have .msi…
Serlok
  • 432
  • 1
  • 10
  • 24
1
vote
1 answer

How to interpret pre build error codes from Visual Studio 2010

I have been working with Visual Studio pre build events and I find the error codes rather unhelpful for example, adding a pre-build event like this: $(ProjectPath)\DoStuff.exe This gives me an error: exited with code 267 Or adding like…
1
vote
2 answers

Visual studio 2010 pre-build event to compile & deploy a solution

i need to set a pre-build event in visual studio that will build and deploy a solution. the separate solution is in a directory below the current directory of the solution that i am working in. does that make sense? top level dir …
Anthony
  • 536
  • 1
  • 8
  • 27
1
vote
1 answer

Can you have or mimic within Visual Studio 2008 a Solution Level Pre and Post Build Events?

I would like to know if there is anyway to get the ability to have or at least mimic Pre and Post build events at the Solution level not just at the project level within Visual Studio 2008? Therefor if possible I would like this functionality to be…
1
vote
1 answer

Run a C# file as a pre-build event Visual Studio (.NET Core)

I have a C# file that manipulates some files in a given directory. The files I want it to manipulate are files that lie within the working directory of my project and need to be updated when the build becomes out of date. How do I run this simple C#…
kpaul
  • 355
  • 6
  • 16
1
vote
1 answer

Exception when PreBuildAction calls exe with command input

I have an issue with my (visual studio) pre-build action calling an executable, which requires a console input. The code looks like: using System; using System.Diagnostics; using System.Text; namespace MyMinumumExample { internal class…
HarryKane
  • 129
  • 3
  • 13
1
vote
1 answer

Is there a way to reference link.exe from Microsoft C++ toolset in Visual Studio 2019 without hardcode the path?

I am using link.exe from Microsoft C++ toolset in the pre-build event in a c# project in Visual Studio 2019. The problem is every time the Visual Studio 2019 updates, it changes the path because of the version of MSVC folder. For example: In VS…
1
vote
1 answer

How can I add an existing file to a project in Visual Studio in the pre-build event?

I have a batch file creating a config file that I don't want to share with all team mates over SVN because it's used for developer specific settings. The config file is called from app.config and is necessary in order to build the project and I…
1
vote
0 answers

Pre-Build command returns -1, when script returns 0

I've configured Visual Studio to run a pre-build script. My pre-build script command is like this: call $(SolutionDir)test.bat My bat file is like this: @echo error CS0006: hello bingo and I get the same error when I explicitly return 0, like…
1
vote
1 answer

How can I set Visual Studio 2015's OutDir property programatically, e.g. in a pre-build event, in a C# project?

I need to set the "Output Path" field (which becomes $(OutDir)) of a VS 2015 C# project to a path that is elsewhere defined in an environment variable XX_OUT_DIR. Setting the value of the textbox in the project properties build page to %XX_OUT_DIR%,…
onar3d
  • 41
  • 4
1
vote
1 answer

Visual Studio PreBuildEvent powershell The string is missing the terminator: "

Had the strangest error earlier that I was genuinely confused about, so I thought I would write up a self-answer to help people out. My googlefu turned up nothing neatly, so here we are. This was my original line powershell.exe…
jcolebrand
  • 15,889
  • 12
  • 75
  • 121
1
vote
0 answers

Populating object before build

I have MVC project , but now I want to make version handler containing all the information about git repository , the problem is that when run locally it works perfect using LibGit2Sharp library, but when my application is deployed on the server…
kuskmen
  • 3,648
  • 4
  • 27
  • 54
1
vote
1 answer

Is it possible to make Gyp generate a pre (or post) build step?

I'm using gyp to generate Visual Studio projects, make files, and Xcode projects. I would like to have a pre-build step that calls a command line tool which generates some code that I later compile in, is this possible? Incidentally, in cmake I do…
kmp
  • 10,535
  • 11
  • 75
  • 125
1
vote
1 answer

IAR Pre-Build batch file python call not working

I'm trying to setup a script to increment a build number inside a version file in IAR EW430. I've got the python script and the batch file working from the command line, but when I run it on the IAR IDE, the build number doesn't increment. In the…
Matt C
  • 13
  • 3