获取CodeSmith的版本号

 

private CodesmithVersion GetCodesmithVersion()
{
    
try
    
{
        
string version = typeof(CodeTemplate).Assembly.GetName().Version.ToString();
        
if(version != null)
        
{
            
if (version.IndexOf("3.2">= 0)
                
return CodesmithVersion.Codesmith32;
            
else if (version.IndexOf("3.1">=0)
                
return CodesmithVersion.Codesmith31;
            
else if (version.IndexOf("3.0">=0)
                
return CodesmithVersion.Codesmith30;
            
else if (version.IndexOf("2.6">= 0)
                
return CodesmithVersion.Codesmith26;
        }

    }

    
catch
    
{
        
//could not discover version info.    
    }

    
    
return CodesmithVersion.Unknown;
}
posted on 2006-10-10 15:39  灵风  阅读(176)  评论(0编辑  收藏  举报