Note that if you are using a current nightly you can wrap your diagnostics code in a custom function definition like:
<code><![CDATA[ [Function("get-file-version")]
public string GetFileVersion( string file ) {
System.Diagnostics.FileVersionInfo myFileVersionInfo =
System.Diagnostics.FileVersionInfo.GetVersionInfo(file);
return myFileVersionInfo.FileVersion;
}
]]></code>
</script>
and then call it like:
<property name="fileversion" value="script::get-file-version('somefile.dll')" />
of course if you need to set properties to the individual version components then a custom task is a better option.
Bob, You should be able to drop the above code into your build file if all you need is the file version as a string.
Ian
Price, Henry wrote:
How about something like this? (off the top of my head and without intellisense :)
We've done something similar here - for checking which versions of files are installed etc - had to do it all in script - I've given up on writing custom tasks, they take too long to edit when you need to change stuff :)
<script language="C#"> <code><![CDATA[ public static void ScriptMain(Project project) { System.Diagnostics.FileVersionInfo myFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo("path to your dll"); project.Properties["dll.majorversion"] = myFileVersionInfo.FileMajorPart; project.Properties["dll.minorversion"] = myFileVersionInfo.FileMinorPart; project.Properties["dll.buildversion"] = myFileVersionInfo.FileBuildPart; project.Properties["dll.privateversion"] = myFileVersionInfo.FilePrivatePart; ]]></code> </script>
-----Original Message-----
From: Bob Archer [mailto:[EMAIL PROTECTED] Sent: 30 April 2004 4:21P
To: [EMAIL PROTECTED]
Subject: [Nant-users] get version from dll?
Hi All,
I am creating a build script that deploys our last successful daily build to
our QA machine.
How could I get the version/build number from a dll? Any ideas? I could get the last build number from the build number file that my version task uses, however, if that build failed it will not be the one in the daily build area.
Thanks,
Bob
"This communication is intended solely for the addressee and is confidential and not for third party unauthorised distribution."
--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com
-------------------------------------------------------
This SF.Net email is sponsored by: Oracle 10g
Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE.
http://ads.osdn.com/?ad_id=3149&alloc_id=8166&op=click
_______________________________________________
Nant-users mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-users
