C#获取引用组件的版本信息

       /// <summary>
        /// 当前目录下文件版本
        /// </summary>
        public void FilesVersions()
        {
            Assembly fileAssembly = Assembly.GetEntryAssembly();
            AssemblyName[] assemblyNames = fileAssembly.GetReferencedAssemblies();
            if (assemblyNames != null)
            {
                foreach (AssemblyName an in assemblyNames)
                {
                    LogHelper.Default.Log("FilesVersions:"+ an.Name + " v" + an.Version.ToString(4), LogLevel.Info, 0);
                }
            }
        }

posted on 2018-06-28 15:19  youmeetmehere  阅读(315)  评论(0编辑  收藏  举报

导航