Thanks Gert,
That will help!
I am using a recent nightly build, however I didn't know about fileversioninfo::get-version-info(). I just had another look at the online documentation and I noticed that the function is not currently mentioned. Unless it is some caching issue on my company's proxy server?
http://nant.sourceforge.net/nightly/help/functions/index.html
Regards,
Eduardo
-----Original Message-----
From: Gert Driesen [mailto:[EMAIL PROTECTED]]
Sent: Monday, 25 October 2004 2:36 AM
To: 'Eduardo Garcia-Prieto'; 'Nant Users'
Subject: RE: [Nant-users] Writing a custom function using VB script
Hi Eduardo,
Function is a reserved keyword in VB, therefor you need to escape it by surrounding it with braces :
<[Function]("get-file-version-string-vb")> _
Public Function .....
By the way, you no longer need to define functions for accessing a file's version yourself: in very recent nightly builds, you can use the following snippet to get the file version of a given file :
<echo message="${fileversioninfo::get-file-version(fileversioninfo::get-version-in
fo('file.exe'))}" />
Hope this helps,
Gert
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]] On Behalf Of
> Eduardo Garcia-Prieto
> Sent: dinsdag 19 oktober 2004 0:34
> To: Nant Users ([EMAIL PROTECTED])
> Subject: [Nant-users] Writing a custom function using VB script
>
> Hi,
>
> Does anyone have a working example of how to write a custom
> function using
> VB script?
>
> I tried to write an VB equivalent for the following custom
> function in C#
> but just couldn't get it to work. I'm wondering if there was problem
> applying the Function attribute as this requires the '<' '>'
> characters?
>
>
> C# VERSION:
> ----------
>
> <!-- get-file-version-string: Gets the version string for the
> specified
> file. -->
> <script language="C#" prefix="localscript">
> <code><![CDATA[
> [Function("get-file-version-string")]
> public string
> GetFileVersionString(string filePath)
> {
>
> return
> System.Diagnostics.FileVersionInfo.GetVersionInfo(filePath).Fi
> leVersion;
>
> }
> ]]></code>
> </script>
>
>
> VB VERSION:
> --------------
> <script language="VB" prefix="localscript">
> <code><![CDATA[
> <Function("get-file-version-string-vb")> _
> Public Function
> GetFileVersionStringVB(filePath As
> String) As String
>
> Return
> System.Diagnostics.FileVersionInfo.GetVersionInfo(filePath).Fi
> leVersion
>
> End Function
> ]]></code>
> </script>
>
> The VB version produces the following error:
>
> Compilation failed:
> C:\DOCUME~1\Eduardo\LOCALS~1\Temp\hantonyk.0.vb(18,0) : error BC30183:
> Keyword is not valid as an identifier.
>
>
> Thank in advance,
>
> Eduardo
>
>
>
> RECIPIENTS ARE REMINDED THAT THIS E-MAIL MESSAGE
> IS STRICTLY CONFIDENTIAL AND INTENDED ONLY FOR USE
> BY THE ADDRESSEE UNLESS OTHERWISE INDICATED.
>
> Investment Data Technologies Pty Ltd advise that they:
> - accept no liability for any abusive, defamatory, obscene,
> illegal, or
> offensive material contained in this e-mail message
> - do not monitor the content of any e-mail messages sent from
> Investment Data Technologies
> - do not authorise or condone the sending of abusive, defamatory,
> obscene, illegal, or offensive material by their employees
> and contractors
> - cannot guarantee that this e-mail message is secure and will not be
> intercepted by a third party.
>
>
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: IT Product Guide on
> ITManagersJournal
> Use IT products in your business? Tell us what you think of
> them. Give us
> Your Opinions, Get Free ThinkGeek Gift Certificates! Click to
> find out more
> http://productguide.itmanagersjournal.com/guidepromo.tmpl
> _______________________________________________
> Nant-users mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/nant-users
>
>
RECIPIENTS ARE REMINDED THAT THIS E-MAIL MESSAGE
IS STRICTLY CONFIDENTIAL AND INTENDED ONLY FOR USE
BY THE ADDRESSEE UNLESS OTHERWISE INDICATED.
Investment Data Technologies Pty Ltd advise that they:
- accept no liability for any abusive, defamatory, obscene, illegal, or
offensive material contained in this e-mail message
- do not monitor the content of any e-mail messages sent from
Investment Data Technologies
- do not authorise or condone the sending of abusive, defamatory,
obscene, illegal, or offensive material by their employees and contractors
- cannot guarantee that this e-mail message is secure and will not be
intercepted by a third party.
