JUST DO IT ~

          我只想當個程序員

          認識 : 看了 淺談.NET中的版本管理 ildasm.exe MyForm.exe

          看了  淺談.NET中的版本管理
          http://www.microsoft.com/china/community/program/originalarticles/techdoc/DOTNETVersion.mspx


          GAC:
          計算機范圍內(nèi)的代碼緩存,它存儲專門安裝的程序集,這些程序集由計算機上的許多應(yīng)用程序共享。在全局程序集緩存中部署的應(yīng)用程序必須具有強名稱,一個程序集如果注冊到了GAC里,被其他程序集合引用的時候,將不會拷貝副本到引用的程序目錄中。 (本文只討論注冊到GAC中的程序集)

          實際就是  system32\ 目錄的做的作用, 系統(tǒng)安裝一份 就可以了,
          其他的程序要用 , 直接到界面上去引用, 不會有任何問題. 在系統(tǒng) using 直接調(diào),  ------反正就是不需要注冊組件文件拷貝.............
          如果沒有 代碼緩存 ...必須要自己注冊dll 文件 然后程序來引用

          好處 : 

          1 多版本維護替換dll

          他的另外一個作用在文中提及,就是可以進行多個版本注冊....... 使用的程序是 1.0dll編譯的 ..在升級到GAC到第二版dll ..................使用的程序不需要重新編譯,只要對 config 文件進行版本替換就可以的....
          這個是比較好的特點,允許我們輕松處理dll的版本
          雖然COM中 使用注冊表和 也能做到這點 dll     但是好像很復(fù)雜 .....

          2.實現(xiàn)簡單......
            步驟   
          1//首先生成強名稱到文件中
          sn –k c:\Version.snk2  //寫類文件
          v1.cs
          using System;
          using System.Reflection;
          [assembly: AssemblyKeyFile(@"c:\Version.snk")] //因為注冊到GAC,所以使用強名稱簽名
          [assembly: AssemblyVersion("1.0.0.0")] //設(shè)置版本號
          namespace V1 {

           3 匯編查看代碼

              D:\c_\forms>ildasm.exe MyForm.exe
          匯編 虛擬機代碼 看實質(zhì)


          ame是程序集的名稱 publicKeyToken是公匙的標記;

          // Metadata version: v2.0.50727
          .assembly extern /*23000001*/ 'System.Windows.Forms'
          {
            .publickeytoken = (B7 7A 5C 56 19 34 E0 89 )                         // .z\V.4..
            .ver 2:0:0:0
          }

          打開%SystemDir%\assembly


          替換dll 不要拷貝文件

          TestVersion.exe.config里面打入
          <?xml version="1.0"?>
          <configuration>
          <runtime>
          <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
          <dependentAssembly>
          <assemblyIdentity name="V1" publicKeyToken=" 758fe4e9db9d8251"/>
          <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0" />
          </dependentAssembly>
          </assemblyBinding>
          </runtime>
          </configuration>
          











          大致對 dotnet下同版本理解

          DotNet中的版本由4個物理號碼組成,如圖(一)
          Assembly Info 的參數(shù)理解

          描述整個程序 版本名稱,
          版本號碼 GUI


          using System.Reflection;
          using System.Runtime.CompilerServices;
          using System.Runtime.InteropServices;

          // General Information about an assembly is controlled through the following 
          // set of attributes. Change these attribute values to modify the information
          // associated with an assembly.
          [assembly: AssemblyTitle("NHibernateWithAccess")]
          [assembly: AssemblyDescription(
          "A sample application showing how to use NHibernate with Access/Jet")]
          [assembly: AssemblyConfiguration(
          "")]
          [assembly: AssemblyCompany(
          "")]
          [assembly: AssemblyProduct(
          "NHibernateWithAccess")]
          [assembly: AssemblyCopyright(
          "")]
          [assembly: AssemblyTrademark(
          "")]
          [assembly: AssemblyCulture(
          "")]

          // Setting ComVisible to false makes the types in this assembly not visible 
          // to COM components.  If you need to access a type in this assembly from 
          // COM, set the ComVisible attribute to true on that type.
          [assembly: ComVisible(false)]

          // The following GUID is for the ID of the typelib if this project is exposed to COM
          [assembly: Guid("da9b5517-7c63-4ed2-8f42-e573af1df70b")]

          // Version information for an assembly consists of the following four values:
          //
          //      Major Version
          //      Minor Version 
          //      Build Number
          //      Revision
          //
          [assembly: AssemblyVersion("1.0.0.0")]
          [assembly: AssemblyFileVersion(
          "1.0.0.0")]






          sn –k c:\Version.snk
          





          posted on 2008-09-15 12:14 小高 閱讀(637) 評論(0)  編輯  收藏 所屬分類: Build構(gòu)建|git版本控制

          導(dǎo)航

          <2008年9月>
          31123456
          78910111213
          14151617181920
          21222324252627
          2829301234
          567891011

          統(tǒng)計

          常用鏈接

          留言簿(3)

          隨筆分類(352)

          收藏夾(19)

          關(guān)注的blog

          手冊

          搜索

          積分與排名

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 黑山县| 天津市| 剑阁县| 忻城县| 陆良县| 塔城市| 惠安县| 土默特左旗| 女性| 宝清县| 普宁市| 黄浦区| 湖州市| 瑞安市| 永宁县| 嘉祥县| 攀枝花市| 承德市| 元氏县| 宁安市| 平湖市| 通辽市| 肃宁县| 宁南县| 新营市| 错那县| 临湘市| 巩义市| 邢台县| 勐海县| 宿迁市| 满城县| 收藏| 灵山县| 教育| 黄浦区| 安义县| 比如县| 阳泉市| 忻州市| 子长县|