获取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;
}
{
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;
}