NAnt is open source :-) . We can just add a task which uses the
SetEnvironmentVariable() API function. Interoping it in C# is not a
big problem. It would take only two lines. Anybody interested to add
it into the contrib project? :-)

IMHO, It is not unsafe code  and hence can be easily incorporated.

[DllImport("kernel32.dll")]
public static int SetEnvironmentVariable(string name, string value);


On Mon, 7 Feb 2005 20:52:25 -0600 (GMT-06:00), Merrill Cornish
<[EMAIL PROTECTED]> wrote:
> Someone in our group is trying to decide whether it would be worthwhile for 
> him to convert a number of build batch files into NAnt 0.85.  He' grumbling 
> about how much NAnt he has to write to dulicate the work now done by the 
> batch files.  He's right, of course.  Since NAnt is XML based, almost anthing 
> else will be more concise than a NAnt script.
> 
> What really worries/annoys him is NAnt's handling of environment variables.
> 
> The compile step in the current batch files typically require a group of 
> environment variables to be set for things like include paths, lib paths, and 
> so on.  In the batch file, all you have to do is several SET statements, 
> followed by one or more compile steps.  Each compile step then sees the 
> original group of environment  variables you set up.  For some compile steps, 
> the evironment variables need to be changed, but  that's just a few more SET 
> statements in the batch file.  Deleting an environment variable need by one 
> step, but not the next, is also just a SET (to nothing).
> 
> In NAnt, setting up all of those environment variables seems to be a real 
> pain.  As I understand, one of .NET's security features is that its API does 
> not allow environment or registry variable to be set (although there are ways 
> around that limitation at the programming level).
> 
> As far as I can tell, he would have to
> 
> * Set NAnt properties to the environment variable values from the current 
> batch files.
> 
> * Use the <exec> task for each compile step.
> 
> * For each <exec>, use its <environment> nested element to specify the names 
> of the environment variables the compile step needs, referencing the 
> properties to get the values (rather than hard coding them into each call).
> 
> Among other things, this means that where one batch file SET statement would 
> serve for any number of following compile steps, he would have to re-specify 
> the whole set of enviroment variables for each <exec>.
> 
> So far, he's not really impressed with NAnt as a substitute for the current 
> batch files.
> 
> My questions for any of you are:
> 
> *  Is there a better way in NAnt to getting the environment variables set for 
> each <exec>?
> 
> *  What arguments can I use to show that despite its verbosity, NAnt is the 
> better way to go anyway?
> 
> Merrill
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now.
> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
> _______________________________________________
> Nant-users mailing list
> Nant-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nant-users
> 


-- 
Vagmi
http://geekswithblogs.net/vagmi.mudumbai
http://installneo.blogspot.com


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to