The behavior exhibited is not unique to Ant--it's how shells work.  If you 
open a shell (start->run->cmd) you'll get a shell.  If you set env 
variables in that shell, they don't persist to another shell that you 
might open.
So the <exec> task in Ant is executing in a shell.  Once the <exec> task 
completes, that shell is closed.  The next <exec> task gets a new shell, 
and hence the env variables are gone.
I agree w/ Chris Erskine's suggestion to write a batch file which calls 
vsvars32.bat followed by the VS build.

Regards,
Nick G





[EMAIL PROTECTED]
01/11/2005 11:31 AM
Please respond to "Ant Users List"
 
        To:     "Ant Users List" <user@ant.apache.org>
        cc: 
        Subject:        RE: RE: Environment variables


Thanks for your answers.

Is there any particular reason why this is not possible?
-- 
Gilbert Jeiziner

"Erskine, Chris" <[EMAIL PROTECTED]> schrieb am 11.01.2005 17:15:49:

> Or try calling a batch file which first calls your .Net setup and then 
calls
> Visual Studio.
> 
> Chris Erskine
> 
> EDS Consulting Services
> F5-EDS-001
> 2424 Garden of the Gods Rd
> Colorado Springs, CO  80919
> 
> Phone: 719-265-5962
> 
> 
> > -----Original Message-----
> > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > Sent: Tuesday, January 11, 2005 9:04 AM
> > To: user@ant.apache.org
> > Subject: AW: Environment variables
> > 
> > <exec> creates a new process and <env>s are passed to that process. 
When
> > that
> > has finished all environment settings are lost. There is no way to set 

env
> > variables from ant ... with usual things.
> > 
> > Under windows is an executable called "setx" which you could try.
> > 
> > 
> > Jan
> > 
> > > -----Ursprüngliche Nachricht-----
> > > Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> > > Gesendet am: Dienstag, 11. Januar 2005 16:58
> > > An: Ant Users List
> > > Betreff: Environment variables
> > >
> > > Hi,
> > >
> > > I'm using ant to build visual studio solutions (simple
> > > command line with
> > > the <exec> task).
> > >
> > > We have 2 versions of visual studio .NET (unfortunately, we have to
> > > maintain those 2 version).
> > >
> > > So, before running ant to build the solution, we have to set
> > > up specific
> > > environment variables for
> > > the version of .NET we are using (for those who know .NET, we
> > > just call
> > > vsvars32.bat)
> > >
> > > When I integrate the call to vsvars32.bat to set the
> > > variables (<exec>
> > > task again), the env-vars are not persistant, meaning
> > > that when the exec task to build the solutions is called, the
> > > environment
> > > variables are simply not set and
> > > the solution would not build. we have to call vcvars32.bat
> > > outside of ant,
> > > and then it works.
> > >
> > > Is there something i am missing or why do the variables
> > > disappear from one
> > > exec task to the other? Can
> > > someone suggest what can be done?
> > >
> > > Thanks in advance
> > >
> > > --
> > > Gilbert Jeiziner
> > >
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to