File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
src/Installer/Microsoft.Dotnet.Installation/Internal Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change 77using System . Net ;
88using System . Net . Http ;
99using System . Net . Http . Headers ;
10+ using System . Reflection ;
1011using System . Security . Cryptography ;
1112using System . Text ;
1213using System . Threading ;
@@ -67,8 +68,12 @@ private static HttpClient CreateDefaultHttpClient()
6768 Timeout = TimeSpan . FromMinutes ( 10 )
6869 } ;
6970
70- // Set user-agent to identify dnup in telemetry
71- client . DefaultRequestHeaders . UserAgent . ParseAdd ( "dnup-dotnet-installer" ) ;
71+ // Set user-agent to identify dnup in telemetry, including version
72+ var informationalVersion = typeof ( DotnetArchiveDownloader ) . Assembly
73+ . GetCustomAttribute < AssemblyInformationalVersionAttribute > ( ) ? . InformationalVersion ;
74+ string userAgent = informationalVersion == null ? "dotnetup-dotnet-installer" : $ "dnup-dotnet-installer/{ informationalVersion } ";
75+
76+ client . DefaultRequestHeaders . UserAgent . ParseAdd ( userAgent ) ;
7277
7378 return client ;
7479 }
You can’t perform that action at this time.
0 commit comments