-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
UmbracoVersion.cs
71 lines (65 loc) · 2.72 KB
/
UmbracoVersion.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Configuration;
using System.Reflection;
using Semver;
namespace Umbraco.Core.Configuration
{
/// <summary>
/// Represents the version of the executing code.
/// </summary>
public static class UmbracoVersion
{
// BEWARE!
// This class is parsed and updated by the build scripts.
// Do NOT modify it unless you understand what you are doing.
/// <summary>
/// Gets the version of the executing code.
/// </summary>
public static Version Current { get; } = new Version("8.0.0");
/// <summary>
/// Gets the version comment of the executing code (eg "beta").
/// </summary>
public static string CurrentComment => "alpha.41";
/// <summary>
/// Gets the assembly version of Umbraco.Code.dll.
/// </summary>
/// <remarks>Get it by looking at a class in that dll, due to medium trust issues,
/// see http://haacked.com/archive/2010/11/04/assembly-location-and-medium-trust.aspx,
/// however fixme we don't support medium trust anymore?</remarks>
public static string AssemblyVersion => new AssemblyName(typeof(UmbracoVersion).Assembly.FullName).Version.ToString();
/// <summary>
/// Gets the semantic version of the executing code.
/// </summary>
public static SemVersion SemanticVersion { get; } = new SemVersion(
Current.Major,
Current.Minor,
Current.Build,
CurrentComment.IsNullOrWhiteSpace() ? null : CurrentComment,
Current.Revision > 0 ? Current.Revision.ToInvariantString() : null);
/// <summary>
/// Gets the "local" version of the site.
/// </summary>
/// <remarks>
/// <para>Three things have a version, really: the executing code, the database model,
/// and the site/files. The database model version is entirely managed via migrations,
/// and changes during an upgrade. The executing code version changes when new code is
/// deployed. The site/files version changes during an upgrade.</para>
/// </remarks>
public static SemVersion Local
{
get
{
try
{
// fixme - this should live in its own independent file! NOT web.config!
var value = ConfigurationManager.AppSettings["umbracoConfigurationStatus"];
return SemVersion.TryParse(value, out var semver) ? semver : null;
}
catch
{
return null;
}
}
}
}
}