Just committed an AssemblyFunctions class as outlined below. Took a bit longer that 10mins with the docs and all but a pretty straightforward job :)

Ian
Gert Driesen wrote:

I suggest adding an AssemblyFunctions class with the following functions :

assembly::get-version(string)
assembly::get-major-version(string)
assembly::get-minor-version(string)
assembly::get-revision-version(string)
assembly::get-build-version(string)
assembly::get-full-name(string)
assembly::get-name(string)
assembly::get-culture(string)

You wouldn't even have to load the assembly in a separate domain explicitly
as the AssemblyName.GetAssemblyName method will do this for you.

So it seems like a 10 minute job (for which I don't have time right now as
I'm about to leave, but I could add this tomorrow or so) ...

Gert

----- Original Message ----- From: "Bob Archer" <[EMAIL PROTECTED]>
To: "Ian MacLean" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Friday, April 30, 2004 5:55 PM
Subject: RE: [Nant-users] get version from dll?



Ian,


You are WAY beyond me. I am just learning to use the existing tasks,
never mind write my own. :)

-----Original Message-----
From: Ian MacLean [mailto:[EMAIL PROTECTED]
Sent: Friday, April 30, 2004 11:40 AM
To: Bob Archer
Cc: [EMAIL PROTECTED]
Subject: Re: [Nant-users] get version from dll?

If your dll is a .net assembly you could load it using Assembly.LoadFrom

somthing like:

assembly = Assembly.LoadFrom( AssemblyPath );
AssemblyName name = assembly.GetName();
version = name.Version.ToString();

should do the trick. Its a good candidate for a custom function. For
extra points load the assembly in a new AppDomain so it doesn't pollute
the nant process space.

Ian

Bob Archer wrote:



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














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

Reply via email to