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
>
>
-------------------------------------------------------
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