Here is an example of what you want to do:

<exec program="${devenv.exe}">
        <arg>
                <arg value="${devenv.sln}" />
                <arg value="/${devenv.action}" />
                <arg value="${devenv.cfg" />
        </arg>
        <environment>
                <option name="PATH" value="${devenv.path}" />
                <option name="INCLUDE" value="${devenv.include}" />
                <option name="LIB" value="${devenv.lib}" />
        </environment>
</exec>

I have not verified that the <arg> part works correctly but it looks
right judging from the documentation. I previously had put the command
line arguments in the commandline attribute. I think this method is
cleaner if it works.

An alternative is to have <exec> execute a batch file which calls
vsvars32.bat and then executes devenv. Something similar to the
following:

<exec program="${devenv.bat}">
        <arg>
                <!-- arguments -->
        </arg>
</exec>

The batch file would look something like this:

call %PATH_TO_VSVARS32%\vsvars32.bat
devenv %arguments%

Note that in the first approach you will need to somehow generate the
environment variables and then pass them to <exec> while in the second
approach you just call vsvars32.bat.

I hope this helps!

--
Edwin G. Castro
[EMAIL PROTECTED]
 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:nant-users-
> [EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
> Sent: Thursday, July 01, 2004 2:11 PM
> To: [EMAIL PROTECTED]
> Subject: [Nant-users] Setting environment variables in the <exec> task
> 
> Hi All,
> I'm calling devenv through the <exec> task in a build script that is
> kicked off as part of a scheduled task.  I need to set up the
> environment variables in the <exec> task equal to what they would be
> after running vsvars32.bat. Does anyone have an example of setting
> environment variables as a part of the <exec> task?  NAnt's help
> mentions using a collection of option elements, but I'm not sure what
> that means.  I'm new to NAnt, any help is greatly appreciated.
> 
> Thanks
> Joe
> 
> 
> 
> 




-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to