Если я правильно понял о чем вы, то:
public static class SetEnv
{
[System.Security.SuppressUnmanagedCodeSecurity]
// Для AutoCAD 2007 и выше:
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode ,EntryPoint = "acedGetEnv")]
extern static private Int32 acedGetEnv(string var, StringBuilder val);
[System.Security.SuppressUnmanagedCodeSecurity]
// Для AutoCAD 2007 и выше:
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode ,EntryPoint = "acedSetEnv")]
extern static private Int32 acedSetEnv(string var, string val);
static private void AddPath(string path)
{
StringBuilder buf = new StringBuilder(16536);
acedGetEnv("ACAD", buf);
buf.Append(";"); buf.Append(path);
acedSetEnv("ACAD", buf.ToString());
}
static public void AddSupportFiles()
{
AddPath(Path.Combine(ModPlusVariables.CurDir, "Res"));
//AddPath(Path.Combine(ModPlusVariables.CurDir, "Data"));
}
static public void RemoveSupportFiles()
{
try
{
string str1 = Path.Combine(ModPlusVariables.CurDir, "Res");
//string str2 = Path.Combine(ModPlusVariables.CurDir, "Data");
StringBuilder buf = new StringBuilder(16536);
acedGetEnv("ACAD", buf);
buf.Replace(str1, "");
//buf.Replace(str2, "");
buf.Replace(";;", ";");
acedSetEnv("ACAD", buf.ToString());
}
catch (Autodesk.AutoCAD.Runtime.Exception)
{ System.Windows.MessageBox.Show("Ошибка удаления путей поддержки"); }
}
}
Примечание - ModPlusVariables.CurDir - это папка расположения исполняемого dll-файла. Находится так
public static string CurDir = new FileInfo(Assembly.GetExecutingAssembly().Location).DirectoryName;
З.Ы. Эта тема вроде уже обсуждалась...