如题,想检验下客户机中的组件版本,应该使用那些函数?

解决方案 »

  1.   


    string ver,compant,desc; 
     //加载程序集文件 
    Assembly assembly = Assembly.LoadFile("d:\\test.dll"); 
    //获取版本 
    ver = assembly.GetName().Version.ToString();  
    //获取公司 
    compant = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute))).Company; 
    //获取描述说明 
    desc = ((AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute))).Description;
      

  2.   


    using System.Diagnostics; FileVersionInfo myFileVersion = FileVersionInfo.GetVersionInfo("WindowsFormsApplication24.exe");
    String strFileVersion = string.Format("{0}.{1}.{2}.{3}", myFileVersion.FileMajorPart, myFileVersion.FileMinorPart, myFileVersion.FileBuildPart, myFileVersion.FilePrivatePart);
      

  3.   

    不好意思三楼兄弟,没刷出来你,thanks all the time