468,136 Members | 1,435 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,136 developers. It's quick & easy.

VB:Form - How to write version attribute out to database on post-build?

Hi, I have a windows form application. I'd like to write the current version attribute out to a logfile automatically when the build completes. I've been looking at the post-build events and these seem to be only for command lines. I tried writing an executable console app that was called post-build to get the attribute version. My code looked like this:

Expand|Select|Wrap|Line Numbers
  1. Imports System
  2. Imports System.Text
  3. Imports System.IO
  4. Imports System.Reflection
  6. Module AIRVerWriter
  8.     Sub Main()
  9.         Dim asmAIR As Assembly
  10.         Dim avaAIR As AssemblyVersionAttribute
  12.         asmAIR = Assembly.GetCallingAssembly()
  13.         avaAIR = AssemblyVersionAttribute.GetCustomAttribute(asmAIR, GetType(AssemblyVersionAttribute))
  15.         Using sw As StreamWriter = New StreamWriter("c:\verlog.txt")
  17.             sw.WriteLine(avaAIR.Tostring())
  18.             sw.Close()
  19.         End Using
  20.     End Sub
  22. End Module
I compiled and set this up as a post-build event, and it runs just fine, and writes to the desired log, but instead of writing my just-built project's version ( it writes it's own version ( to the log. How can I capture this information when I perform a build? I have tried a number of variations and they all give me the executing module's version, not the built module.

Windows XP SP2
VB.Net 2005
Thanks in advance,

Jan 4 '08 #1
0 833

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

reply views Thread by mfdatsw1 | last post: by
3 posts views Thread by D.P. Roberts | last post: by
2 posts views Thread by craig.kelly | last post: by
27 posts views Thread by didacticone | last post: by
1 post views Thread by gcdp | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.