public static string GetAssemblyVersion()

in src/Microsoft.Extensions.Configuration.AzureAppConfiguration/TracingUtils.cs [79:108]


        public static string GetAssemblyVersion(string assemblyName)
        {
            if (!string.IsNullOrEmpty(assemblyName))
            {
                Assembly infoVersionAttribute = AppDomain.CurrentDomain.GetAssemblies().SingleOrDefault(assembly => assembly.GetName().Name == assemblyName);

                if (infoVersionAttribute != null)
                {
                    string informationalVersion = infoVersionAttribute.GetCustomAttribute<AssemblyInformationalVersionAttribute>()?.InformationalVersion;

                    if (string.IsNullOrEmpty(informationalVersion))
                    {
                        return null;
                    }

                    // Commit information is appended to the informational version starting with a '+', so we remove
                    // the commit information to get just the full name of the version.
                    int plusIndex = informationalVersion.IndexOf('+');

                    if (plusIndex != -1)
                    {
                        informationalVersion = informationalVersion.Substring(0, plusIndex);
                    }

                    return informationalVersion;
                }
            }

            return null;
        }