File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff line change 11// Copyright (c) Microsoft Corporation.
22// Licensed under the MIT License.
33
4- using System . Reflection ;
4+ using System . Diagnostics ;
55
66namespace Microsoft . DurableTask ;
77
@@ -13,15 +13,19 @@ public static class DurableTaskUserAgentUtil
1313 /// <summary>
1414 /// The name of the SDK used in the user agent string.
1515 /// </summary>
16- static string SdkName => "durabletask-dotnet" ;
16+ const string SdkName = "durabletask-dotnet" ;
17+
18+ /// <summary>
19+ /// The version of the SDK used in the user agent string.
20+ /// </summary>
21+ static readonly string PackageVersion = FileVersionInfo . GetVersionInfo ( typeof ( DurableTaskUserAgentUtil ) . Assembly . Location ) . FileVersion ;
1722
1823 /// <summary>
1924 /// Generates the user agent string for the Durable Task SDK based on a fixed name and the package version.
2025 /// </summary>
21- /// <returns></returns>
26+ /// <returns>The user agent string. </returns>
2227 public static string GetUserAgent ( )
2328 {
24- var version = typeof ( DurableTaskUserAgentUtil ) . Assembly . GetName ( ) . Version ;
25- return $ "{ SdkName } /{ version ? . ToString ( ) ?? "unknown" } ";
29+ return $ "{ SdkName } /{ PackageVersion ? . ToString ( ) ?? "unknown" } ";
2630 }
2731}
You can’t perform that action at this time.
0 commit comments