diff --git a/Pilz/AssemblyAppVersion.cs b/Pilz/AssemblyAppVersion.cs index 2f42cc0..9f65787 100644 --- a/Pilz/AssemblyAppVersion.cs +++ b/Pilz/AssemblyAppVersion.cs @@ -1,9 +1,20 @@ -namespace Pilz; +using System.Reflection; + +namespace Pilz; [AttributeUsage(AttributeTargets.Assembly)] -public class AssemblyAppVersionAttribute(string version, int build, AppChannel channel) : Attribute +public class AssemblyAppVersionAttribute : Attribute { - public AppVersion Version { get; } = new(new Version(version), build, channel); + public const string EntryAssemblyVersionKey = "{EntryAssemblyVersion}"; + + public AppVersion Version { get; } + + public AssemblyAppVersionAttribute(string version, int build, AppChannel channel) + { + if (version.Contains(EntryAssemblyVersionKey)) + version = version.Replace(EntryAssemblyVersionKey, Assembly.GetEntryAssembly().GetName().Version.ToString()); + Version = new(new Version(version), build, channel); + } public AssemblyAppVersionAttribute(string version) : this(version, 1) { diff --git a/Pilz/Pilz.csproj b/Pilz/Pilz.csproj index 256ff0d..b63ef1e 100644 --- a/Pilz/Pilz.csproj +++ b/Pilz/Pilz.csproj @@ -5,7 +5,7 @@ latest enable annotations - 2.3.4 + 2.3.5