Exemplo n.º 1
0
        private string GetVersionFromAssembly(Assembly assembly) {
            if (assembly == null)
                return null;

            string version = assembly.GetInformationalVersion();
            if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0"))
                version = assembly.GetFileVersion();

            if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0"))
                version = assembly.GetVersion();
            
            if (String.IsNullOrEmpty(version) || String.Equals(version, "0.0.0.0")) {
                var assemblyName = assembly.GetAssemblyName();
                version = assemblyName != null ? assemblyName.Version.ToString() : null;
            }

            return !String.IsNullOrEmpty(version) && !String.Equals(version, "0.0.0.0") ? version : null;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="assembly"></param>
        public AsmInfo(Assembly assembly) {
            assembly.ShouldNotBeNull("assembly");

            FullName = assembly.FullName;
            AssemblyName = assembly.GetName();

            // NOTE : CodeBase는 동적으로 Loading 한 Assembly에 대해서는 값을 조회할 수 없다.
            // this.CodeBase = assembly.CodeBase;
            Company = assembly.GetCompany();
            Configuration = assembly.GetConfiguration();
            Copyright = assembly.GetCopyright();
            Culture = assembly.GetCulture();
            DefaultAlias = assembly.GetDefaultAlias();
            Description = assembly.GetDescription();
            InfomationalVersion = assembly.GetInformationalVersion();
            Product = assembly.GetProduct();
            Title = assembly.GetTitle();
            Trademark = assembly.GetTrandemark();
            Version = AssemblyName.Version;
            Win32FileVersion = assembly.GetFileVersion();
        }