Results 1 to 4 of 4

Thread: Can I change source code with a Pre-build event?

  1. #1

    Thread Starter
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Can I change source code with a Pre-build event?

    I've got a variable, BuildDateTimeStamp, would it be possible to add a pre build event to update the value of this variable?
    Code:
     Dim BuildDateTimeStamp = #4/12/2011 10:29:19 AM#
    Then if I rebuilt in a couple minutes, it would automatically change to
    Code:
     Dim BuildDateTimeStamp = #4/12/2011 10:35:23AM#

    I have seen examples of people getting the build date from the version, but on this assembly the version is a static value that does not often change.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  2. #2
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Can I change source code with a Pre-build event?

    I guess my questions are: what are you using this variable for? Does it need to be declared as a variable in your code? Or do you just need access to it's value? Can you use the modified date of the compiled file? (.exe, .dll - whatever you are compiling to)

  3. #3

    Thread Starter
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: Can I change source code with a Pre-build event?

    I guess my questions are: what are you using this variable for?
    I will be using it in the application for logging functionality.

    Does it need to be declared as a variable in your code? Or do you just need access to it's value?
    I suppose I could use just the value.

    Can you use the modified date of the compiled file? (.exe, .dll - whatever you are compiling to)
    This assembly is in the GAC, so I would rather not go down that road.

    Here's a little more background information, this assembly is an add-in that is used by one of our vendor's products. If the version changes, the assembly needs to be reconfigured with the vendor's product, which is a pain, so we hard code the version. This makes it difficult to know which build is in which environment, which is why I would like to automatically set a build date, and log the value.
    That is the very essence of human beings and our very unique capability to perform complex reasoning and actually use our perception to further our understanding of things. We like to solve problems. -Kleinma

    Does your code in post #46 look like my code in #45? No, it doesn't. Therefore, wrong is how it looks. - jmcilhinney

  4. #4
    Master Of Orion ForumAccount's Avatar
    Join Date
    Jan 2009
    Location
    Canada
    Posts
    2,802

    Re: Can I change source code with a Pre-build event?

    Does this help? It looks like you can run pretty much whatever you want pre- and post-build.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width