0

I'm using

[assembly: AssemblyVersion("1.0.*")] 

and I've commented out

[assembly: AssemblyFileVersion("1.0.0.*")] 

When I run the app with

Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString()); 

I get:

1.0.5308.25417 

The fourth value (Revision) seems to be pretty random IMO. And build number never changes. I'm a bit confused about these numbers. In a perfect world I'd like the build number to increment everytime I "Release" and manually update major and minor but I dont seem to be able to fix that.

If I instead use:

[assembly: AssemblyVersion("1.0.*")] 

I get:

1.0.0.25589 

Which lets me manually update the build and give a "random" number within the build. Is it possible to let it trigger by the "release"? And how do I reset the build number?

1
  • You've reversed the numbers in your question. Using * for the revision is not meaningful, the value you get is based on the time of the day you built the project. Your version number goes backwards if you build early in the day, not a good property of a version number. Nobody likes version numbers like this, read up on "semantic version numbering". Commented Jul 14, 2014 at 13:39

1 Answer 1

2

They aren't random; they are time-based. From MSDN

The default build number increments daily. The default revision number is the number of seconds since midnight local time (without taking into account time zone adjustments for daylight saving time), divided by 2.

If you want another option, you can use build-server tools, which can often automate putting in per-build values for you; in the case of TeamCity, this is the AssemblyInfo patcher, and can use any parameters in your build, or a range of inbuilt functions:

enter image description here

Sign up to request clarification or add additional context in comments.

5 Comments

Oh ok, that makes sense! :) Can't I just use it for the build id then? What triggers the build id to increment? (Without TeamCity I mean)
which of the numbers are you calling "build id"?
Sorry, the 3rd one. I look at it like this Major.Minor.Build.Daily revision
@Dave that is indeed "build": see the quote I gave already: "The default build number increments daily"
Oh, I mixed it up with revision! Thanks Marc for a really good answer, I wish more people here were like you! Accepted!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.