Kedziora, Rebecca wrote:
Anyone,
On our build boxes we don't have the include or lib set up in the
system environment so in order to build we run the vsvars32.bat and
build the projects.
Would the vsvars32.bat be the best approach to execute or are there
better approaches to setting up the environment? After the build is
complete I don't want any environment left around. We want our builds
to establish it own environment since we have many builds with
different needs but share the same build box.
If vsvars32.bat is the best approach how do you execute it from the
build script?
I tried using the exec task but I am doing something wrong. I am
trying to use the environment %VS71COMNTOOLS% since that is where the
bat file resides.
Are you saying you're trying to use %VS71COMNTOOLS% in order to find the
vsvars32.bat file? If so, then you're running into a chicken-and-egg
problem - the vs71comntools variable won't be defined yet, unless
you've manually defined it some other way.
I don't think you can do it by executing the .bat file. The reason is
that the .bat file will execute in a subprocess, and the changes it
makes to its environment aren't passed back to the parent NAnt process.
There are several approaches that work, depending on your situation. As
one person pointed out, you can explicitly set the variables using the
<setenv> task. You can then have several different NAnt include files,
each of which sets the variables to a different configuration. This
works very well if you're managing multiple builds on a build server,
but can be problematic if developers are doing builds on their own
machines. That's because it's often the case that developers install
things. You can require developers to provide their own include files,
or you can use a NAnt property to define a prefix for the path (e.g. a
NAnt command line option such as "-D:VSINSTALL=E:\Program Files\...." if
they've installed Visual Studio to their E drive, etc.) , or you can do
what I did, which is to read the registry. This only works if you know
the specific version of Visual Studio you need, since you'll need to
know the exact registry entry, but it's a good way to mask the whole
problem from the developers and takes less maintenance if things move
around.
Gary
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Nant-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nant-users