|
6 | 6 | using Microsoft.FeatureManagement; |
7 | 7 | using System; |
8 | 8 | using System.Diagnostics; |
| 9 | +using System.Reflection; |
9 | 10 |
|
10 | 11 | namespace publisher; |
11 | 12 |
|
@@ -84,6 +85,16 @@ public static void ConfigureRunApplication(IHostApplicationBuilder builder) |
84 | 85 | builder.Services.TryAddSingleton(GetRunApplication); |
85 | 86 | } |
86 | 87 |
|
| 88 | + [System.AttributeUsage(System.AttributeTargets.Assembly, Inherited = false, AllowMultiple = false)] |
| 89 | + sealed class PublisherReleaseVersionAttribute : System.Attribute |
| 90 | + { |
| 91 | + public string Version { get; } |
| 92 | + public PublisherReleaseVersionAttribute(string releaseVersion) |
| 93 | + { |
| 94 | + this.Version = releaseVersion; |
| 95 | + } |
| 96 | + } |
| 97 | + |
87 | 98 | private static RunApplication GetRunApplication(IServiceProvider provider) |
88 | 99 | { |
89 | 100 | var putNamedValues = provider.GetRequiredService<PutNamedValues>(); |
@@ -156,11 +167,14 @@ private static RunApplication GetRunApplication(IServiceProvider provider) |
156 | 167 | var activitySource = provider.GetRequiredService<ActivitySource>(); |
157 | 168 | var logger = provider.GetRequiredService<ILogger>(); |
158 | 169 |
|
| 170 | + var releaseVersion = Assembly.GetEntryAssembly()?.GetCustomAttribute<AssemblyFileVersionAttribute>()?.Version ?? "0.0.0"; |
| 171 | + |
| 172 | + |
159 | 173 | return async cancellationToken => |
160 | 174 | { |
161 | 175 | using var activity = activitySource.StartActivity(nameof(RunApplication)); |
162 | 176 |
|
163 | | - logger.LogInformation("Running publisher..."); |
| 177 | + logger.LogInformation("Running publisher {ReleaseVersion}...", releaseVersion); |
164 | 178 |
|
165 | 179 | await putNamedValues(cancellationToken); |
166 | 180 | await putGateways(cancellationToken); |
|
0 commit comments