Prasad,

The <asminfo> task can only be used to generate an AssemblyInfo file, not to
read individual values from such a file.

I assume you build an assembly containing this AssemblyInfo.cs file as part
of your build procedure, right ?

You can get the assembly version from that compiled assembly using this:

<property name="build.version"
value="${assemblyname::get-version(assembly::get-name('path to your
assembly'))}" />

You could also use the <regex> task to extract the assembly version from the
AssemblyInfo.cs (by first loading the content of AssemblyInfo.cs instead a
property using the <loadfile> task).

Hope this helps,

Gert
----- Original Message ----- 
From: "nbl prasad" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, September 22, 2005 9:12 AM
Subject: Reading AssemblyInfo.cs


> Gert,
> I have posted the below query in nant user list
> but no reply from users.
>
> I am using following code to read and set the version
> number from AssemblyInfo.cs to label it in VSS.
>
> <target name= "GetAssVersion" description="Gets the
> Assembly Version">
> <asminfo
> output="C:\FinPlanSoln4.2\Models\AssemblyInfo.cs"
> language="CSharp">
>       <imports>
>          <import namespace="System" />
>          <import namespace="System.Reflection"/>
>          <attributes>
>          <attribute type="AssemblyVersionAttribute"
> value="${build.version}" />
>       </attributes>
>    </asminfo>
> </target>
>
> For Labeling
> <target name= "LabelVSS1" description="Get the latest
> MPF Model Files">
> <call target="GetAsm"/>
> <vsslabel
>                   user="Lakshmi.Prasad"
>                   password=""
> dbpath="C:\vss\srcsafe.ini"
>                   path="$/test"
>                   comment="New build version:
> ${build.version}"
> label="${build.version}"
>                   />
> </target>
>
>
> but i am getting following error
> Property evaluation failed.
> Expression: ${build.version}
>               ^^^^^^^^^^^^^
>     Property 'build.version' has not been set.
>
> Please help me.
>
> Regards
> Prasad
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>


-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. 
Download it for free - -and be entered to win a 42" plasma tv or your very
own Sony(tm)PSP.  Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Nant-users mailing list
Nant-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to