prebuild

What's an easy way to access prebuild macros such as $(SolutionDir) and $(DevEnvDir) from code in C#?

Right now I'm thinking write the paths to a file in the pre-build event and then read from that file in the code, but I'm wondering if there's an easier more elegant way. edit: This is sort of a follow up to Help with one step build all projects + installer (.NET + WiX) since I didn't really get an answer to that, seeing if I can get an...

Pre-build MSBuild task to update AssemblyInfo not in sync with built exe

I am using a pre-build task in Visual Studio 2008 that invokes msbuild: C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe $(MSBuildProjectDirectory)\version.targets /p:Configuration=$(ConfigurationName) Inside version.targets, I am updating the AssemblyInfo.cs file to replace version information: <FileUpdate Encoding="ASCII...

Visual Studio Setup Project-- adding prebuild step

Hi, I want to make my build process for producing a setup project to be a single click. However, I also want to add {smartassembly} to the build step to obfuscate the build, but only on our build machine. How can I add a pre-build step to a visual studio 2008 vdproj? Basically, I want to move the command line argument to obfuscate th...

Problem with prebuild event in Visual Studio replacing $(SolutionDir) with *Undefined*

I believe the problem is documented here and looks like it might be a bug in visual studio, but I'm wondering if anyone knows of a workaround. Basically I have the following 2 lines (among other things) one right after the other in the prebuild event. "C:\WINDOWS\Microsoft.NET\Framework\v3.5\MSBuild.exe" /p:configuration=Release;platf...

Pre -build events on VS 2008 did not executed

I'm tring to run build of C# solution on vs2008 and discovered that pre-build events for projects containing in the solution were not executed. What can be reason of such behavior ? ...

What is the easiest way to reset ERRORLEVEL to zero?

I have a post-build event that runs some commands for a c# project. The last command would sometimes cause the ERRORLEVEL value not equils to zero and then the build fails. I want to append an extra line of command to always set the ERRORLEVEL value to zero. What is the most convenient way to do that? ...

Making output in VC++ point to lines of source code

At work we have a prebuild step that reads over our source code and automatically generates data based on some annotations in the code. If the prebuild tags are poorly formatted or it finds something it doesn't know how to deal with it prints an error. Just like other builder errors, these can be clicked on to direct you to the line cont...

Multiple Pre-Build Events in Visual Studio?

I've followed a blog post by Scott Hanselman for managing configuration with PreBuild Events and have it working fine. I now want to split up my configuration into a couple of different files, so need to exectue the command again before the build. The problem is the PreBuild event text all gets executed as one console command. How can ...

Pre-build step in makefile

Hi! How can I run a script, which must execute before all other makefile commands? And it will be nice (but not mandatory) to the script is not executed if there is nothing to build. I've searched SO and Google, but can't find anything. I have this workaround: # myscript.bat output is empty CHEAT_ARGUMENT = (shell myscript.bat) CFLAG...

Auto-generating C++ code in a pre-build event using Visual Studio

I'm trying to use a pre-build event in Visual Studio (VS 2005 to be specific) to run a Python script which will automatically generate a .cpp file. The trouble I'm running into is that the compiler doesn't seem to know that this file is dirty and needs to be rebuilt until after the build has finished, which means that I need to build th...

VS2008 Pre-Build Event Command BuildAction=None

Hi Guys, I am trying to add a prebuild event which essentially sets Build Action = None For a list of files before the solution is packaged up for release. How would I go about adding this & what command would I use to exclude a number of files in the web solution ? i.e. \script\some-script.js [Set Build Action = None] etc \script\...

best way to handle prebuild and post build events while making a setup

hi i have many prebuild and postbuild events in different projects. i want to write these events in a single batch file and then call this script in the main project please tell me this is the correct way or any other best way of handlling these events while making a setup thanks please tell me how to handle prebuild and postbuild ev...

Pre-Build Set Build Action = None ?

Hi Guys, I have 2 .config files for my project - evidently one for debug and one for release. I am trying to add a prebuild event which essentially sets Build Action = None For a whole list of files before the solution is packaged up for release as I dont want them included. Currently, I have to do this manually [total pain] and w...

MS-Build BeforeBuild not firing

I'm customising a .csproj project to run some custom tasks before the main build. However, I can't get the tasks to execute at all. I uncommented the <Target Name="BeforeBuild" /> element in the .csproj file and added a simple Message task, but when I build, the message doesn't appear in my output, so it seems the task isn't running. S...

How to identify where I am publishing to for use in the pre-build event

I would like to use Nant to create an environment-specific web.config during the build process when I'm publishing to a given location. For example, when I am publishing to my TEST server, I want the web.config's connection string to point to the TEST database. When in PROD, to the PROD database. I have Nant working in the pre-build, ...

I want to run a script during C# build, but **only** when the project is not up to date

I am trying to set up a proper way to do automatic versioning for my C# projects in .Net. The requirements are: the assembly is to be built only when is is not up to date. (normal behaviour in Visual Studio and via MSBuild) When it is built the assembly is to get the proper version assigned. I have found a solution to give me the ve...

Pre-build event fails

I set a prebuild event to: $(TargetDir)MyConsoleApp But when I run the application I get the following output: ------ Build started: Project: BlahBlahBlah, Configuration: Debug x86 ------ 'd:\users\user\documents\visual' is not recognized as an internal or external command, operable program or batch file. C:\Windows\Microsoft.NET...