Can I populate variables at compile time?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Terry Olsen

    Can I populate variables at compile time?

    I would like to put program info in my applications' about screen such as
    compile date & time, lines of code, etc. Is there a way to do this
    automatically when I compile?


  • Andrew McNerlin

    #2
    Re: Can I populate variables at compile time?

    Hello Terry,

    It might be worth looking at the Visual Studio Extensibility Center at:



    Hope this helps,

    Andrew McNerlin
    [color=blue]
    > I would like to put program info in my applications' about screen such
    > as compile date & time, lines of code, etc. Is there a way to do this
    > automatically when I compile?
    >[/color]


    Comment

    • Anand[MVP]

      #3
      RE: Can I populate variables at compile time?

      You can get the version number of you application. and if you auto increment
      your version number, you do get something similar to what you want.

      The other thing you can try is to take the Date and Time of creation of your
      assembly to be the compilation time and dispaly that.

      --
      Rgds,
      Anand
      VB.NET MVP



      "Terry Olsen" wrote:
      [color=blue]
      > I would like to put program info in my applications' about screen such as
      > compile date & time, lines of code, etc. Is there a way to do this
      > automatically when I compile?
      >
      >
      >[/color]

      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: Can I populate variables at compile time?

        "Terry Olsen" <tolsen64@hotma il.com> schrieb:[color=blue]
        >I would like to put program info in my applications' about screen such as
        >compile date & time, lines of code, etc. Is there a way to do this
        >automaticall y when I compile?[/color]

        Not directly. I am curious why you don't want to set the labels' text at
        runtime.

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        • Cor Ligthert [MVP]

          #5
          Re: Can I populate variables at compile time?

          Herfried,
          [color=blue]
          >
          > Not directly. I am curious why you don't want to set the labels' text at
          > runtime.
          >[/color]
          I think that at least beside Terry, Anand, Andrew, I (and when you reread
          the question) you do that.

          It can in some cases be handy.

          :-)

          Cor


          Comment

          • Herfried K. Wagner [MVP]

            #6
            Re: Can I populate variables at compile time?

            "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> schrieb:[color=blue][color=green]
            >> Not directly. I am curious why you don't want to set the labels' text at
            >> runtime.
            >>[/color]
            > I think that at least beside Terry, Anand, Andrew, I (and when you reread
            > the question) you do that.[/color]

            I misread the OP's post. I thought he wanted to display simple version
            information only.

            --
            M S Herfried K. Wagner
            M V P <URL:http://dotnet.mvps.org/>
            V B <URL:http://classicvb.org/petition/>

            Comment

            • Jay B. Harlow [MVP - Outlook]

              #7
              Re: Can I populate variables at compile time?

              Terry,
              As the others suggest, getting lines of code is going to be challenging, I
              seriously question the usefulness of it in an about box.

              Compile date & time would be useful, but I have not found a good method of
              retrieving it. I've considered a custom attribute, however I'm not sure how
              one would define said attribute, as one would need the value of the
              attribute set at compile time. A pre-compile utility that initialized the
              attribute value (ala the AssemblyVersion attribute) might be useful.

              Generally I display a number of Assembly level attributes in my About Box,
              including by not limited to:

              Assembly.GetNam e().Name
              Assembly.GetNam e().Version
              AssemblyTitleAt tribute.Title
              AssemblyProduct Attribute.Produ ct ' product name
              AssemblyInforma tionVersionAttr ibute.Informati onalVersion ' product
              version
              AssemblyConfigu rationAttribute .Configuration ' Debug/Release
              AssemblyFileVer sionAttribute.V ersion

              In fact I display the above info for all loaded assemblies in a grid (ala
              the VS about box) to see version info for class libraries...

              A VS 2005 version (it uses Generics) of my AboutBoxForm is available as part
              of the of my Xml Export Example at:



              I hope to have a VS 2003 version as a recipe at the above site later this
              week...

              --
              Jay [MVP - Outlook]
              ..NET Application Architect, Enthusiast, & Evangelist
              T.S. Bradley - http://www.tsbradley.net


              "Terry Olsen" <tolsen64@hotma il.com> wrote in message
              news:ucpFJ0S1FH A.1040@TK2MSFTN GP14.phx.gbl...
              |I would like to put program info in my applications' about screen such as
              | compile date & time, lines of code, etc. Is there a way to do this
              | automatically when I compile?
              |
              |


              Comment

              Working...