Thanks for the response.  I'll have to check with my boss, but I don't
know that a template will do it.  They don't want to tie the build
process and the app together any stronger than they have to.  But I'll
run it by the powers that be.  Thanks!

Regards,
     John W. Ellenberger
     Senior Programmer/Analyst
     Geac Commercial Systems Division
 


-----Original Message-----
From: Gert Driesen [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, December 07, 2004 01:46
To: 'Ian MacLean'; John Ellenberger
Cc: [EMAIL PROTECTED]
Subject: RE: [Nant-users] LoadFile in .85 RC1


 

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of 
> Ian MacLean
> Sent: dinsdag 7 december 2004 3:43
> To: John Ellenberger
> Cc: [EMAIL PROTECTED]
> Subject: Re: [Nant-users] LoadFile in .85 RC1
> 
> John Ellenberger wrote:
> 
> > I'm hoping someone can help answer a question in regards to the
> > LoadFile task.  It's actually not the task itself, but associated 
> > functionality.  Here's the dilemma:
> >  
> > I'm checking an AssemblyInfo.vb file out, and want to update the
> > 'AssemblyVersion' key with the value from version (from 
> NantContrib)
> > that I keep track of.  I've done some fairly ugly string
> manipulation
> > to get it right, but now I have a fairly big issue.  How to I write
> > the contents of a property out to a file?? :p  Am I missing 
> something?
> >  
> > If anyone is interested, here's the code to do the parse:
> >  
> >   <loadfile file="${solutionBaseDirectory}AssemblyInfo.vb"
> > property="assembly_file" />
> >   <property name="searchString" value="AssemblyVersion(" />
> >   <if test='${string::contains(assembly_file, searchString)}'>
> >    <property name="totalLength" 
> > value="${string::get-length(assembly_file)}" />
> >    <property name="lengthOfLineStart" 
> > value="${string::index-of(assembly_file, searchString) + 17}" />
> >    <property name="endOfLine" 
> > value="${string::substring(assembly_file, lengthOfLineStart, 
> > int::parse(totalLength) - int::parse(lengthOfLineStart))}" />
> >    <property name="endOfLineStart" 
> > value="${string::index-of(endOfLine,')')}" />
> >    <property name="endOfLineLength" 
> value="${int::parse(totalLength) -
> > int::parse(endOfLineStart)}" />
> >    <property name="assembly_file_beginning"
> > value='${string::substring(assembly_file, 0, lengthOfLineStart)}' />
> >    <property name="assembly_file" 
> > 
> value='${assembly_file_beginning}${sys.version}${string::subst
> ring(assembly_file,
> > int::parse(totalLength) - int::parse(endOfLineStart),
> > int::parse(endOfLineStart))}' />
> >    <!-- determine how to save file out -->
> >   </if>
> 
> wow ! - I've never seen the nant expression language used in
> quite that 
> way.
> I'd seriously consider using either:
> - the AssemInfo task 
> (http://nant.sourceforge.net/release/latest/help/tasks/asminfo
> .html) or
> - an inline script using the script task 
> (http://nant.sourceforge.net/release/latest/help/tasks/script.html)
> 
> <asseminfo> allows you to do what you are after using a built in task
> and with <script> you can use any .Net code which will be 
> much easier ( 
> and clearer ) than trying to use NAnt as a procedural 
> programming language.

And if you can use a "template" AssemblyInfo file, then I'd strongly
recommend use a <copy> task with a <replacetokens> filter.

Gert



-------------------------------------------------------
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://productguide.itmanagersjournal.com/
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to