Get Assembly Path and Name
using System;
using System.IO;
using System.Reflection;
using System.Windows.Forms;
public class Utils
{
/// <summary>
/// Gets the assembly title.
/// </summary>
/// <param name="asm">The asm.</param>
/// <returns></returns>
private static string GetAssemblyTitle(Assembly asm)
{
object[] attributes = asm.GetCustomAttributes(typeof(AssemblyTitleAttribute), false);
if (attributes.Length > 0)
{
AssemblyTitleAttribute titleAttribute = (AssemblyTitleAttribute)attributes[0];
if (titleAttribute.Title != "")
{
return titleAttribute.Title;
}
}
return "ReviewPal";
}
/// <summary>
/// Gets the assembly path.
/// </summary>
/// <param name="asm">The asm.</param>
/// <returns></returns>
private static string GetAssemblyPath(Assembly asm)
{
return Path.GetDirectoryName(asm.CodeBase);
}
}
Related examples in the same category