add support for entry assembly version placeholder
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<LangVersion>latest</LangVersion>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>annotations</Nullable>
|
||||
<Version>2.3.4</Version>
|
||||
<Version>2.3.5</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
Reference in New Issue
Block a user