Different behaviour for Visual Studio Build depending if built in IDE or from command line?

Is it possible to control build event batch file behaviour depending on whether the build is run from the IDE or the command line.

We have several versions of our product. It contains COM objects that need to be registered. This COM registration is done by a batch file called from a custom build step in the respective project.

The problem is that if a developer runs an automated build for one version from the command line in the background while working on another version in the IDE the automated build will register the COM objects from the version not being worked on in the IDE.

So, is there a way to control whether the registration takes place depending on if the build is done in the IDE or from the command line using devenv?

Thanks.

Answers


I don't know that VS "knows" how it's being run. I'd be surprised if there wasn't something somewhere that flags whether or not it's being run from the command line, however we may not have any access to that.

Perhaps this can be solved using a build configuration. When you build from the command line, set the build configuration value to a configuration that excludes the COM registration step. I think you should be able to write into your post build batch a test for the appropriate build configuration (I'm almost sure that VS has a build macro value for the current build config) and branch the logic accordingly. Of course, this means each developer needs to be aware of this. Although you could make a batch file in the project for doing these builds which includes the necessary build switches/values.

I'm curious what your scenario is that you have one developer building the same application two different ways simultaneously.


Here's possibly the easier approach: put your long running background builds on another machine. If you don't have the budget for another physical machine (as cheaply as they can be had) do it on a VM. There are free VM hosts out there. I have had reasonably good luck with VMWare Server running on my development desktop. You'll need ample disk space and memory, but both are pretty cheap.


Need Your Help

uisegmentedcontrol doesn't detect touch on certain segments

iphone uiscrollview touch uisegmentedcontrol

I have a uisegmentedcontrol within a horizontally scrolling uiscrollview. The scrollview is working just fine and the content is resized according to the width of the segmentedcontrol. The segmen...

outputStream.write has has buffer overflow?

java io

I'm trying to send a byte[] to a serial port. However outputstream.write(byte[]); only works when byte[].length contains less then about 100 bytes.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.