需要配置配置文件

 

1,codeBase:只可用于共享程序集

①:从网络加载

    
         
    
    
  
        
          
      
      
     

 

②:指定文件的路径

    
         
    
    
  
        
          
      
      
     

publicKeyToken:该程序集的公钥

可以通过sn -T Timber.Assembly.dll 查看公钥

 

 

=====================测试:

Assembly a = Assembly.Load("Timber.Assembly, Version=1.0.0.0, Culture=neutral, PublicKeyToken=ad83e08169849671");            Console.WriteLine(a.FullName);            Console.ReadKey();

 

 

2,probing:可用于共享和私有程序集

 
    
         
    
  
   
      
      

 privatePath:指定检索程序集的路径

 

 =====================测试:

 Assembly a = Assembly.Load("ClassLibrary1, Version=1.0.0.0"); Console.WriteLine(a.FullName); Console.ReadKey();

 

 

3,指定程序集版本

例如:最开始发布的程序集有些BUG,或者该程序集需要新的功能,就需要发布新的版本。

就需要我们在配置文件里面指定

 

    
         
    
  
    
      
        
        
      
      

oldVersion:必须设置,oldVersion特性指定应把程序集的哪个版本重定向到新版本上 。使用oldVersion特性可以指定一个范围。

newVersion:必须设置,指定新版本