Build Number - how to auto increment?

  • Thread starter Thread starter Terry
  • Start date Start date
T

Terry

I can't believe I can't find the ansewer to this question anywhere, but so
far I have had no luck searching the forums or the help. I am using VS2008
Professional and can not figure out how to auto-increment the build number.
I have built this assembly many times, yet the My.Application.Info.Build
property returns 0. What am I missing. VB6 had an auto-increment on the
project properties dialog, but I can not find something similiar in VS2008.
 
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

-Alex
 
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

-Alex
 
Terry said:
I can't believe I can't find the ansewer to this question anywhere, but so
far I have had no luck searching the forums or the help. I am using VS2008
Professional and can not figure out how to auto-increment the build number.

Although you can use * for parts of the version number, I always wanted
greater control over versioning than this. I wanted to define the
initial private built part and have this incremented by 1 each time I built.

To do this I adapted a macro which does the job very well. You can find
the original macro here:

http://www.jmedved.com/default.aspx?page=vbnet_vb6ver&rendering=xhtml&language=en

This modifies the AssemblyInfo.vb file (which is normally hidden away
inside the 'My Project' folder) so you'll need to set this up as
required and ensure that it is editable if under source code control.

One of the changes I made to the macro was to get it to update the
AssemblyFileVersion attribute instead of the AssemblyVersion attribute.
AssemblyFileVersion is the version number that appears in Explorer and
when you select Properties for an executable. If you change
AssemblyVersion, anything that was referencing your component will fail
to bind to the new version, but the AssemblyFileVersion is ignored for
this check and can be changed to whatever you want.

HTH.
 
Terry said:
I can't believe I can't find the ansewer to this question anywhere, but so
far I have had no luck searching the forums or the help. I am using VS2008
Professional and can not figure out how to auto-increment the build number.

Although you can use * for parts of the version number, I always wanted
greater control over versioning than this. I wanted to define the
initial private built part and have this incremented by 1 each time I built.

To do this I adapted a macro which does the job very well. You can find
the original macro here:

http://www.jmedved.com/default.aspx?page=vbnet_vb6ver&rendering=xhtml&language=en

This modifies the AssemblyInfo.vb file (which is normally hidden away
inside the 'My Project' folder) so you'll need to set this up as
required and ensure that it is editable if under source code control.

One of the changes I made to the macro was to get it to update the
AssemblyFileVersion attribute instead of the AssemblyVersion attribute.
AssemblyFileVersion is the version number that appears in Explorer and
when you select Properties for an executable. If you change
AssemblyVersion, anything that was referencing your component will fail
to bind to the new version, but the AssemblyFileVersion is ignored for
this check and can be changed to whatever you want.

HTH.
 
Thanks!
--
Terry


Alex Clark said:
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

-Alex
 
Thanks!
--
Terry


Alex Clark said:
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

-Alex
 
Thanks!
--
Terry


(O)enone said:
Although you can use * for parts of the version number, I always wanted
greater control over versioning than this. I wanted to define the
initial private built part and have this incremented by 1 each time I built.

To do this I adapted a macro which does the job very well. You can find
the original macro here:

http://www.jmedved.com/default.aspx?page=vbnet_vb6ver&rendering=xhtml&language=en

This modifies the AssemblyInfo.vb file (which is normally hidden away
inside the 'My Project' folder) so you'll need to set this up as
required and ensure that it is editable if under source code control.

One of the changes I made to the macro was to get it to update the
AssemblyFileVersion attribute instead of the AssemblyVersion attribute.
AssemblyFileVersion is the version number that appears in Explorer and
when you select Properties for an executable. If you change
AssemblyVersion, anything that was referencing your component will fail
to bind to the new version, but the AssemblyFileVersion is ignored for
this check and can be changed to whatever you want.

HTH.
 
Thanks!
--
Terry


(O)enone said:
Although you can use * for parts of the version number, I always wanted
greater control over versioning than this. I wanted to define the
initial private built part and have this incremented by 1 each time I built.

To do this I adapted a macro which does the job very well. You can find
the original macro here:

http://www.jmedved.com/default.aspx?page=vbnet_vb6ver&rendering=xhtml&language=en

This modifies the AssemblyInfo.vb file (which is normally hidden away
inside the 'My Project' folder) so you'll need to set this up as
required and ensure that it is editable if under source code control.

One of the changes I made to the macro was to get it to update the
AssemblyFileVersion attribute instead of the AssemblyVersion attribute.
AssemblyFileVersion is the version number that appears in Explorer and
when you select Properties for an executable. If you change
AssemblyVersion, anything that was referencing your component will fail
to bind to the new version, but the AssemblyFileVersion is ignored for
this check and can be changed to whatever you want.

HTH.
 
Sorry, but I have another question. I downloaded the macro, but how do I
'connect' it to the solution build. The documentation I have found talks
about building a console app and then calling it. But this does not look
like that approach as it is a handler for the BuildStart event. If you don't
mind, can you connect the pieces for me?
 
Sorry, but I have another question. I downloaded the macro, but how do I
'connect' it to the solution build. The documentation I have found talks
about building a console app and then calling it. But this does not look
like that approach as it is a handler for the BuildStart event. If you don't
mind, can you connect the pieces for me?
 
Sorry, I should have tried it before I got back to you. When I attempt to
put the * in the last two boxes, I get an "invalid version format" message.
I have tried various combinations and the only one it will accept is 1.0.0.*.
I am using VS 2008 if that makes any difference.
 
Sorry, I should have tried it before I got back to you. When I attempt to
put the * in the last two boxes, I get an "invalid version format" message.
I have tried various combinations and the only one it will accept is 1.0.0.*.
I am using VS 2008 if that makes any difference.
 
Terry said:
I can't believe I can't find the ansewer to this question anywhere, but so
far I have had no luck searching the forums or the help. I am using
VS2008
Professional and can not figure out how to auto-increment the build
number.
I have built this assembly many times, yet the My.Application.Info.Build
property returns 0. What am I missing. VB6 had an auto-increment on the
project properties dialog, but I can not find something similiar in
VS2008.

This feature never worked in VB6 anyway as it always needed manual
intervention in a team environment.
 
Terry said:
I can't believe I can't find the ansewer to this question anywhere, but so
far I have had no luck searching the forums or the help. I am using
VS2008
Professional and can not figure out how to auto-increment the build
number.
I have built this assembly many times, yet the My.Application.Info.Build
property returns 0. What am I missing. VB6 had an auto-increment on the
project properties dialog, but I can not find something similiar in
VS2008.

This feature never worked in VB6 anyway as it always needed manual
intervention in a team environment.
 
Alex said:
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

Please note - this doesn't simply /increment/ these values. It
recalculates them according to these rules:

http://www.eggheadcafe.com/aspnet_answers/vsnetgeneral/May2006/post26751279.asp
... you specify an asterisk (*) for the version's build number
(e.g. "1.0.*"). This will cause build number to be equal to
the number of days since January 1, 2000 local time, and for
revision to be equal to the number of seconds since midnight
local time, divided by 2.

Also, if you start writing libraries (DLL's) make sure you /only/ update
the Assembly/File/Version in this way and *not* the /Assembly/Version.
Everything in .Net is implicitly Early Bound, so applications built
against [Assembly] Version 1.2.3.4 will not "just work" if you later
release the same DLL [Assembly] Version 1.2.3.*5*.
Of course, you can use Manifests to handle this, but the /default/
behaviour is for applications to /only/ run against the version they
were built with.

HTH,
Phill W.
 
Alex said:
Put a * in place of the number in the project properties, for example
instead of setting the version to 1.0.0.0, set it to 1.0.*.* and that will
auto-increment the build & revision numbers each time you compile.

Please note - this doesn't simply /increment/ these values. It
recalculates them according to these rules:

http://www.eggheadcafe.com/aspnet_answers/vsnetgeneral/May2006/post26751279.asp
... you specify an asterisk (*) for the version's build number
(e.g. "1.0.*"). This will cause build number to be equal to
the number of days since January 1, 2000 local time, and for
revision to be equal to the number of seconds since midnight
local time, divided by 2.

Also, if you start writing libraries (DLL's) make sure you /only/ update
the Assembly/File/Version in this way and *not* the /Assembly/Version.
Everything in .Net is implicitly Early Bound, so applications built
against [Assembly] Version 1.2.3.4 will not "just work" if you later
release the same DLL [Assembly] Version 1.2.3.*5*.
Of course, you can use Manifests to handle this, but the /default/
behaviour is for applications to /only/ run against the version they
were built with.

HTH,
Phill W.
 
Back
Top