Title: Message

Henry,

 

This worked great…. A small change I had to add .ToString() to the assignment statements and close the method brace.

 

<script language="C#">

        <code><![CDATA[

                    public static void ScriptMain(Project project) {

                                    System.Diagnostics.FileVersionInfo myFileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo("\\\\devevolution2k3\\c$\\DailyBuild\\bin\\Geac.Financials.Business.dll");

                                    project.Properties["dll.majorversion"] = myFileVersionInfo.FileMajorPart.ToString();

                                    project.Properties["dll.minorversion"] = myFileVersionInfo.FileMinorPart.ToString();

                                    project.Properties["dll.buildversion"] = myFileVersionInfo.FileBuildPart.ToString();

                                    project.Properties["dll.privateversion"] = myFileVersionInfo.FilePrivatePart.ToString();

                        }

            ]]></code>

</script>

 

FYI: I didn’t create the properties first either.

 

Thanks a lot,

Bob

 

 


From: Price, Henry [mailto:[EMAIL PROTECTED]
Sent: Friday, April 30, 2004 12:01 PM
To: Bob Archer; [EMAIL PROTECTED]
Subject: RE: [Nant-users] get version from dll?

 

Yeah, just put it in a target (if you want), define the properties first (I'm not sure you HAVE to do it first, but I always do). Something like this...

 

<target name="Main">

    <property name="dll.majorversion" value=""/>

    <property name="dll.minorversion" value=""/>

    <property name="dll.buildversion" value=""/>

    <property name="dll.privateversion" value=""/>

    <call target="getassemblyversion"/>

    <echo message="Your assembly version is: ${dll.majorversion}.${dll.minorversion}.${dll.buildversion}.${dll.privateversion}"/>

</target>

 

<target name="getassemblyversion" description="gets assembly version">

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

</target>

-----Original Message-----
From: Bob Archer [mailto:[EMAIL PROTECTED]
Sent: 30 April 2004 4:54P
To: Price, Henry; [EMAIL PROTECTED]
Subject: RE: [Nant-users] get version from dll?

Wow... that looks promising. But, ??? Does this task run automatically? How would I access this info... would it be:

 

${dll.majorversion}

 

???

 

Thanks a lot,

Bob

 

 


From: Price, Henry [mailto:[EMAIL PROTECTED]
Sent: Friday, April 30, 2004 11:41 AM
To: Bob Archer; [EMAIL PROTECTED]
Subject: RE: [Nant-users] get version from dll?

 

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



"This communication is intended solely for the addressee and is confidential and not for third party unauthorised distribution."

Reply via email to