Title: How do you pass properties from NAnt to C#?
Misha-
You can use the XMLNodeReader class ResolveEntityMethod method to read the value
take a look at
http://msdn.microsoft.com/library/default.asp?url="">
-Martin
----- Original Message -----
Sent: Tuesday, June 08, 2004 1:10 PM
Subject: [Nant-users] How do you pass properties from NAnt to C#?

I've been using Ant for years and have always used the following way to pass properties from my build.xml files to my Java programs:

<sysproperty key="my.property" value="${my.property}" />

In Java, I can access this property by:

System.getProperty("my.property");


I want to do the exact same thing but using NAnt and C#. I've tried doing this in NAnt:


        <property name="sys.env.my.property" value="my.property.value"/>

        <sysinfo verbose="true"/>

And then this in C#:


Environment.GetEnvironmentVariable("sys.env.my.property"); //doesn't work


Environment.GetEnvironmentVariable("my.property"); //doesn't work either


How can you access properties that are set in a build file, from a C# program?


Thanks for any help.

Misha



Reply via email to