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

How to Add PreBuildEvent in install.ps1 in Nuget

Configure NuGet package to add a build event when installed I follow Paul's answer and do it $project.Properties.Item("PreBuildEvent").Value = "your build event here" Below is my install.ps1 $project.Properties.Item("PreBuildEvent").Value…
IloveIniesta
  • 342
  • 4
  • 20
3
votes
2 answers

Add source files and assembly references on pre build event

I want to have a "manifest.json" file in my project, that contains a list of .cs and .dll files the project depends on, but are not part of the project. To compile those files also on build, I need to somehow tell Visual Studio to include those…
Van Coding
  • 24,244
  • 24
  • 88
  • 132
2
votes
1 answer

pre-build event to change setup project's ProductVersion doesn't take effect until after the build

I've followed the steps described here to modify the ProductCode and ProductVersion on my setup project on each build, using a prebuild event. (meaning- I created a console application that uses the above-mentioned code to modify the .vdproj file,…
2
votes
1 answer

Generate C# classes from XML only if XML has changed

I have a pre-build event on a C# project which runs xsltproc to transform some XML into C# source files. The generated source then gets built in the normal way. This means that the project always gets built regardless of whether the XML has…
Paul
  • 1,897
  • 1
  • 14
  • 28
2
votes
1 answer

Include source files generated by prebuild-event

I want to generate C# classes from a flatbuffer schema, and consume these classes in another project. For this I need to invoke the flatbuffer schema compiler to generate the classes. I do not want to check in the class-files, but rather generate…
MariusQS
  • 23
  • 3
2
votes
1 answer

Trying to use MSBuild from command line for WP7 solution

I'm attempting to build a WP7 solution file form the command line using MSBuild (the solution file builds perfectly fine inside VS). So far I have the following: msbuild Test.WP7.sln /t:rebuild /p:OutputPath="bin\Release" /p:Platform="Any CPU"…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
2
votes
1 answer

Setting up requirements.txt in prebuild gitpod.yml

Whenever I open my gitpod workspace I have to re-install my requirements.txt file. I was reading about the gitpod.yml file and see that I have to add it in there so the dependencies get installed during the prebuild. I can't find any examples of…
Ryan Thomas
  • 488
  • 4
  • 14
2
votes
0 answers

globally install a tool if not installed from a c# build command

My goal: To run dotnet gitversion /updateprojectfiles as part of the build. My limitations: not all machines have gitversion installed, so I need to install it on those without. However, Microsoft's dotnet tool install will return the code 1 when…
PMO1948
  • 2,210
  • 11
  • 34
2
votes
0 answers

How do you scaffold DbContext as a pre-build event

I'm trying to set up our project to re-scaffold the DbContext and all the models before each build in order to catch any database changes within our API. However when I set up the pre-build command and run/build the project, it just spawns a bunch…
2
votes
1 answer

Usage of RebusTransactionScope

I need clarification on using transaction scopes in Rebus. In Configuration options I have o.HandleMessagesInsideTransactionScope(); Now Do I need to use the statement using scope=new RebusTransactionScope() in my Handlers or the Setup I have made…
Amour Rashid
  • 290
  • 3
  • 11
2
votes
0 answers

Determine platform (x86 or x64) in post-build event

Our c# project depends on some native dlls that we copy to output directory in a post-build command. We target both x86 and x64bit so we have to copy 32-bit version of native dlls for our x86 build and 64-bit versions of dlls for x64 build. We use…
2
votes
1 answer

Update resource before multi target Visual Studio .csproj build

I have a .csproj file with multiple targets. It starts like that: net35;net40;net45;netcoreapp2.0;netstandard2.0 ... It is a C# project that uses…
Itai Bar-Haim
  • 1,686
  • 16
  • 40
2
votes
1 answer

How to update .config item value in pre-build event

I have an app.config file that (initially) looks like this: I need a way to update '[MySetting]' value in pre-build event without copying…
user2081328
  • 159
  • 3
  • 15
2
votes
1 answer

Request user input in pre or post build event - Visual Studio

I want the user to approve an action in the pre or post build event by requesting an user input - like 'y' or 'n'. Thereby the user can cancel the task if he forgot to switch the Configuration by mistake for example. if $(ConfigurationName) ==…
2
votes
0 answers

Update a file when build a project in Visual Studio

if not exist %UserProfile%\Documents\"Visual Studio 2015"\Templates\ItemTemplates\Regra.zip ( xcopy %cd:bin\Debug=Artefatos\Regra.zip% %UserProfile%\Documents\"Visual Studio 2015"\Templates\ItemTemplates\ ) The code above is a command line…