How did Nant achieve this in C#?

G

Guest

Hi there,

I try to find on the internet on how to achieve this, but still can't find
any good resources till i downloaded Nant.

But there are too many codes inside Nant, and i have no idea which part of
Nant code that can achieve this below.

<?xml version="1.0"?>
<project name="Property Test" default="test" basedir=".">
<property name="project.name" value="PropertyTest"/>
<property name="project.version" value="1.0.0"/>
<target name="test">
<echo message="Building ${project.name}-${project.version}"/>
</target>
</project>

--> I want to get the value of project.name. So i can use the
${project.name} a few times in my xml script.

Any idea on how to achieve this?

Thanks.
 
D

Daniel O'Connell [C# MVP]

Chua Wen Ching said:
Hi there,

I try to find on the internet on how to achieve this, but still can't find
any good resources till i downloaded Nant.

But there are too many codes inside Nant, and i have no idea which part of
Nant code that can achieve this below.

<?xml version="1.0"?>
<project name="Property Test" default="test" basedir=".">
<property name="project.name" value="PropertyTest"/>
<property name="project.version" value="1.0.0"/>
<target name="test">
<echo message="Building ${project.name}-${project.version}"/>
</target>
</project>

--> I want to get the value of project.name. So i can use the
${project.name} a few times in my xml script.

Any idea on how to achieve this?

When you are reading your xml file, when you hit a property tag simply add
that property's name and value to a dictionary and look it up when your
script references it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top