Hi Tim
I'm using the following code snippet for updating the
environment variable. It works fine for me.
<target
name="update-class-path-for-release" >
<property name="release.classpath" value="${WebMethods.Enterprise.Integrator.Home}\lib\activeworks45.jar;
${WebMethods.Enterprise.Integrator.Home}\lib\client45.jar;
${WebMethods.Enterprise.Integrator.Home}\lib\activeworks40.jar;${Agent.File.Set};
${Application.File.Set};${Broker_Patch.Set};${EAF.File.Set};${J2EE.File.Set}"/>
<property name="sys.env.x" value="${environment::get-variable('CLASSPATH')}"/>
<echo message = "Setting CLASSPATH for installing agent services"/>
<script language="C#">
<code><![CDATA[
public static void ScriptMain(Project project)
{
string x = project.Properties["sys.env.x"];
SetEnvironmentVariable("CLASSPATH", project.Properties["release.classpath"]);
}
[ System.Runtime.InteropServices.DllImport( "kernel32") ]
public static extern bool SetEnvironmentVariable( string EnvironmentVariable, string EnvironmentValue );
]]></code>
</script>
<echo message="${environment::get-variable('CLASSPATH')}"/>
<echo message ="CLASSPATH changed"/>
</target>
<property name="release.classpath" value="${WebMethods.Enterprise.Integrator.Home}\lib\activeworks45.jar;
${WebMethods.Enterprise.Integrator.Home}\lib\client45.jar;
${WebMethods.Enterprise.Integrator.Home}\lib\activeworks40.jar;${Agent.File.Set};
${Application.File.Set};${Broker_Patch.Set};${EAF.File.Set};${J2EE.File.Set}"/>
<property name="sys.env.x" value="${environment::get-variable('CLASSPATH')}"/>
<echo message = "Setting CLASSPATH for installing agent services"/>
<script language="C#">
<code><![CDATA[
public static void ScriptMain(Project project)
{
string x = project.Properties["sys.env.x"];
SetEnvironmentVariable("CLASSPATH", project.Properties["release.classpath"]);
}
[ System.Runtime.InteropServices.DllImport( "kernel32") ]
public static extern bool SetEnvironmentVariable( string EnvironmentVariable, string EnvironmentValue );
]]></code>
</script>
<echo message="${environment::get-variable('CLASSPATH')}"/>
<echo message ="CLASSPATH changed"/>
</target>
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tim Mayert
Sent: Wednesday, August 31, 2005 7:08 PM
To: nant-users@lists.sourceforge.net
Subject: [Nant-users] Setting Environment paths in NANT
I am fairly new to
NANT and I was wondering how the best way to set the environment path in a NANT
build project.
I tried the
following in the build, just before the <solution>
call:
<setenv>
<variable name="PATH" path="%PATH%"/>
<variable name="INCLUDE" path="${HEADERINC};${SHAREDTPH};%INCLUDE%"/>
<variable name="LIB" path="${SHAREDLIB};%LIB%"/>
</setenv>
<variable name="PATH" path="%PATH%"/>
<variable name="INCLUDE" path="${HEADERINC};${SHAREDTPH};%INCLUDE%"/>
<variable name="LIB" path="${SHAREDLIB};%LIB%"/>
</setenv>
But when I run the
build I will still get an error stating that one of the header files could
not be found. The header file in the error is in the ${HEADERINC} path
property so this is either not setting correctly or the project is not using
this environment variable and therefore not even checking these paths.
Does the project have to set the solution to use the /useenv setting and if so
then how do you set that?
We are currently
using NANT 0.85 -rc3.
Thanks for any help
on this issue.
SMART Technologies Inc.
Software Developer
Tel. 403.228.8552 Fax 403.228.2500
[EMAIL PROTECTED]
http://www.smarttech.com
Bringing people and ideas together. ™