views:

267

answers:

3

I've got an NMake project in Visual Studio 2008 that has the Build command set to a custom tool that performs a long build task.

Build = "@call MyTool -config $(ConfigurationName)"

I want a way to to pass a special flag ("-quickbuild") to my tool to tell it to do a quick subset of the overall build.

Build = "@call MyTool -config $(ConfigurationName) -quickbuild"

However I want it to be easy to switch between them so I don't actually want to change the build command.

My thought was to change the build command to this:

Build = "@call MyTool -config $(ConfigurationName) $(ShouldQuickbuild)"

and create a visual studio macro that will set the "ShouldQuickbuild" environment variable to "-quickbuild" then call DTE.Solution.SolutionBuild.BuildProject(...) on the project. The problem is it doesn't see the "ShouldQuickbuild" environment variable.

Any ideas on how I can get this working. Is there a better approach for doing what I want?

A: 

Try putting your variable inside of % delimiters, as in %ShouldQuickBuild%.

Darryl
Didn't appear to work. Looking at the build log it just spit %ShouldQuickBuild% straight through.
Screndib
A: 

You can you control this with the "Solution Configureation". Create two new configureations "Debug Quick" and "Release Quick". These would be copies of the originals. Then change the build command for each configuration.

iain
I should have mentioned that in the original post, but unfortunately due to the way we're using the configurations already, I'm not able to edit or add any more.
Screndib
+1  A: 

Use a batch file and check, If the environment is passed on to the batch file, then you can get that in the batch file and call the actual tool that you want.

The batch file would look like this :


@echo off

MyTool -config %1 %ShouldQuickbuild%


IF the environment is not passed to the batch file, you have to somehow get the info across, globally. Is it possible to create a file from a VS macro? Or call an EXE? Then it's quite simple..

rep_movsd