Frage

The actual version number of my solution is placed in Properties/AssemblyInfo.cs:

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

The last part of that number is an askerisk. It will be replaced by an revision number. By the following code in my controller, I am able to get that full version number, including the revision number:

ViewBag.VersionNumber = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString();

Where does MVC3 save the revision number?

War es hilfreich?

Lösung

When using the * in the revision number, then the 3rd digit will increment each day, and the 4th will be generated based on time-of-day.

What you're seeing is the 4th digit generated based on time-of-day. You'll notice that after midnight it will reset close to 0.

If you use a version such as "1.0.*", then the 3rd and 4th digits will generate automatically.

Andere Tipps

The Revision number isn't "Saved" anywhere instead it is just generated each time you build your project (it is written into the assembly as part of the version number but not saved for future builds).

As an aside I noted a behaviour that doesn't seem to be documented anywhere (and caught me out). The Revision number seems to be generated based on the time (and not always date)!

I.e. you have v1.0.0.1234 on Day 1 at 11:00 This changes to v1.0.0.1257 on Day 1 at 11:30

But, on Day 2 at 10:00 you re-build thinking it will change to v1.0.0.1279 or similar but it actually changes to v1.0.0.0950 so producing a "lower" version number that the last build (on Day 1)?!

This doesn't always seem to happen but I would warn against using Revision as a guaranteed value to increment.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top