UserAgent header set in ServiceClient should include more detailed info
Currently the user agent for all AutoRest-generated clients is set like this:
HttpClient.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue(type.FullName,
GetAssemblyVersion()));
Rather than use the assembly version, which is typically just a major version, it would be more useful to include the full semantic version of the client library (e.g. -- 6.13.1 instead of 6.0.0.0). This helps services use telemetry to track adoption of different versions of the client library.
Even better, ServiceClient could have a hook to let derived classes set their own UserAgent.
Please look for and use the AssemblyInformationalVersion attribute if supplied, otherwise fallback to the AssemblyFileVersion attribute.
This is what I need as it would also allow tracking prerelease versions of proxies and works with such proxies published as NuGet packages, given NuGet has limited support for semantic versioning; i.e. using AssemblyInformationalVersion with only a prerelease tag (and without other metadata).
References:
Also, rather than hard code a constant, the above attributes should probably be read at run-time, since for example I generate the AssemblyInfo attributes at build-time using GitVersion.