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
0
votes
0 answers

Visual Studio - Check for Errors After Pre-Build Events

I have a two projects in my visual studio solution. One of them generates source code files for the other, and I want to set up the build events so that this is done automatically when building the child project. I have a pre-build event command in…
Groger
  • 532
  • 3
  • 15
0
votes
0 answers

How to generate Apache Thrift protocol outside source code (but in obj folder like Grpc.Tool)?

I would like to generate the Apache Thrift protocol outside of source folder like the package Grpc.Tools make (generate the protocols files in obj folder) to conserve a clean structure. I develop in C#. I searched on the official documentation,…
0
votes
0 answers

Taskkill doesn't work - is there a changed way to do this in VS 2022 pre-build

I've been using: taskkill /f /fi "imagename eq $(TargetFileName)" .. in the pre-build events to kill the running program upon rebuilding. Now, however, it doesn't seem to work that simple anymore. I'm on .net 6 vs 2022. Any ideas? Thnaks
Zoidboom
  • 11
  • 2
0
votes
1 answer

Run tasks before build in Visual Studio

I use Selenium with Chrome to do Web UI automation test. chromedriver.exe is got from nuget repository. Need to replace with a local chromedriver.exe file sometimes for the version is unmatched with Chrome and I do this in…
ever
  • 63
  • 6
0
votes
1 answer

Visual Studio project dependancy question

I have a Visual Studio solution with projects A, B, and C. A and B are indpendant and should do some task T every time they are build. Project C is denendant to A, B and when C is built, task T should be done as well. For any case it's needed task T…
Ashot
  • 10,807
  • 14
  • 66
  • 117
0
votes
0 answers

All Pre-Build event commands fail with exit code 1

As stated in the title, all pre-build events exit with code 1. I was originally using 'git describe --tags > "$(OutputDir)version.txt"', but I have changed the command here to show that even a simple 'echo' command is failing. I have attempted to…
oSiv
  • 26
  • 4
0
votes
1 answer

Running a pre-build event on every file in a MSVC 2010 project

I'm trying to get Visual Studio 2010 to execute a FOR loop - just like the ones that can be done in a .bat file - as a pre-build event command... No luck this far. Long story short, I'm trying to get Qt's moc.exe to iterate on all my header files at…
xtrium
  • 64
  • 6
0
votes
1 answer

Visual studio pre build event

Im running the following command in my pre build event (get-content "$(SolutionDir)woop.txt") -replace 'HELLO','GOODBYE' | set-content "$(SolutionDir)woop.txt" however im getting the following error: The command "(get-content…
Jonathan D
  • 1,364
  • 2
  • 12
  • 30
0
votes
1 answer

How to pick up the latest version AssemblyInfo.cs as modified by the pre-build event?

I'm currently playing around with the pre and post build events in VS2010, trying to get my SVN version number into the AssemblyInfo.cs file and hence compiled into my build dll. In the pre-build I run a script which updates the AssemblyInfo.cs file…
Pete McPhearson
  • 469
  • 1
  • 7
  • 17
0
votes
1 answer

Update nuget package on a pre build event

I am looking for some advice with updating nuget packages automatically on a pre-build event. I have already searched stack overflow which took me to posts dating six years back most of which does not apply anymore. I did use the below command in…
Vaibhav
  • 47
  • 1
  • 6
0
votes
1 answer

MS Visual Studio subproject compilation prebuilt events IF condition error

My solution has two projects: c++ dll and c# web. Dll project has pre-built event like this IF 2 == 1 ( echo ERROR: Dll building error ) And, obviously, this condition not interrupts building process and it finishes with success, if I run it for…
0
votes
0 answers

How to do REST api call on build event

I am working on .net standard library. I have two requirements Note : client project means - c# project which consumes my library. Call a REST api on pre or post build event of client project. Based on the response , I should create a enum class…
Noorul
  • 873
  • 2
  • 9
  • 26
0
votes
1 answer

Batch file to add git branch into header file

I'm working on a C project, under git, and I would like to add the branch name into an header file. This is my idea: I have a version header file: /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef…
Federico
  • 1,117
  • 6
  • 20
  • 37
0
votes
1 answer

Visual Studio 2010 hangs when running Selenium as Pre-Build event

I have created a bat file which calls selenium server called run-selenium-server.bat which has: java -jar D:\temp\selenium-server\selenium-server.jar Also I have added in my project properties "Build Events" the pre-build event command…
Junior Mayhé
  • 16,144
  • 26
  • 115
  • 161
0
votes
0 answers

Adding DLL file to Resources as content causes copying it to the bin output folder and BadImageFormatException on startup

I'm using the old VS 2015 Pro (C# project) and it seems like there is a bug or I don't understand something. As I discovered by experimenting, adding copies of a dll file (that is already referenced by project) into Resources (bin\Debug\Resources)…